Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regular Expression Match And Compare Captured Groups

Tags:

regex

I'm trying to match some strings of the pattern:

event = sometext1 name = prefix sometext2

I want to match all cases that sometext1 and sometext2 are different. How should I do it with regular expression? Thanks!

like image 286
zhengbli Avatar asked Jun 09 '26 13:06

zhengbli


1 Answers

You can use this regex:

event += +(\w+) +name+ = +\w+ +((?!\1)\w+)\b

RegEx Demo

like image 178
anubhava Avatar answered Jun 11 '26 04:06

anubhava



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!