So, as part of my application, i need it to read data from a text file, and get elements between curly brackets.
e.g:
Server_1 {
/directory1 /directory2
}
Server_2 {
/directory1
/directory2
}
Then something like, if Server == Server_1
, print the directories.
Kind regards,
Michael
You can try with this:
Explanation
\{ matches the character { literally (case sensitive)
(.*?) 1st Capturing Group
.*?
matches any character*?
Quantifier — Matches between zero and unlimited times, as few times as possible, expanding as needed (lazy)\}
matches the character}
literally (case sensitive)Sample Code to extract content inside curly bracket:
Run the code here