I am trying to write a regex that selects everything between two characters.
For example, when the regex encounters a \'§\'
I want it to select everythi
If you have multiple § (char example) use : §([^§]*)§
It will ignore everything between two § and only take what's between the 2 special char, so if you have something like §What§ kind of §bear§ is best
, it will output: §what§ , §bear§
What happening? lets dissect the expression § then ([^§]*) then §
[^§]
0 or more times *
Hope it helps !
For a simple case this should do:
§(.*);
It might need to be modified if you don't want to allow nesting:
§(.*?);
Use this regex
(?<=§).*?(?=;)
How about
"§([^;]*);"
The selected characters between the §
and ;
are available as match group 1.