With the regular expression \*\*([^\*]*)\*\* I can match multiple groups of text inside **'s such as:
this **is** a **test**
Returning is & test.
Given the string that's **right * a test**, how do I adjust my expression to return right * a test? How do I get my expression to exclude two *'s instead of just one?
http://regex101.com/r/aD3pC2
You can use the reluctant quantifier .*?:
\*\*.*?\*\*
assuming it is supported by your regex engine.
To avoid all the nasty escaping I will just use this regex:
([*][*])(.*?)\1
And grab matched group #2.
Live Demo: http://www.rubular.com/r/hJY1eXnLty
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With