Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find in string two first words (Regular expression)

I have string. It can be in the following format

Folkestone Result

Ascot (IRE) Result

Folkestone Last (IRE) Result

Winterfall Win Result

Help create a regular expression to search for words in bold!

(.*)(?=\()|Result

My version is not quite working correctly

like image 889
user3603475 Avatar asked Apr 09 '26 06:04

user3603475


1 Answers

I have solution!

/^(.*?)(?=\(|Result)/m

Alternation inside the lookahead. Use in multiline-mode: m modifier

test at regex101, regex faq

like image 146
Jonny 5 Avatar answered Apr 11 '26 21:04

Jonny 5



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!