Could anybody explain me how a regex should look like if I want to match from:
section(test) only the string test?
Condition is that the string section has to be in front of (test)
Thanks for any help
Could anybody explain me how a regex should look like if I want to match from:
section(test) only the string test?
Condition is that the string section has to be in front of (test)
Thanks for any help
For the regex:
section\((.*)\)
Explaination:
section
: for the string string that need to be there (your condition)\(
: escape the (
to match it(.*)
: capture everything (the thing you want to match)\)
: escape )
and close, which is also the ending condition of the "capture everything"See the demo
I assumed you want everything between the ( )
EDIT regex101 details :
- section matches the characters section literally (case sensitive)
- ( matches the character ( literally
- Capturing group (.*)
- .* matches any character (except newline) Quantifier: * Between zero and unlimited times, as many times as possible, giving back as needed [greedy]
- ) matches the character ) literally