I have the following string:
What is **Sympathy.**
I'm attempting to create a regex statement that will find the string "Sympathy." between the double asterisk, including the double asterisk. However, I can't even figure out how to find the string between first.
This is what I've tried:
(?<=\\*\\*)(.*)(?=\\*\\*)
Any assistance would be appreciated.
I tested this out and it worked
\*{2}(.*?)\*{2}
Breakdown
\*{2}
- matches the character * literally (exactly 2 times)
1st Capturing group (.*?)
- The quantifier will match it between 0 and unlimited times
\*{2}
- matches the character * literally (exactly 2 times)
https://regex101.com/r/uQ0gJ1/1
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