Here is my string
something_a12345678901234567890123 something_else_a12345678901234567890123 hello my_dude
I’d like to catch only
hello my_dude
In short, every bit (where a bit is separated by space) not ending with
_[a-z0-9]{24}
Here is my regex
/[a-zA-Z0-9\\-_]+(?<!_[a-z0-9]{24})/g
But it’s catching almost everything…
>Solution :
Add word boundaries:
\b[\w-]+(?<!_[a-z0-9]{24})\b
See live demo.
Note simplification of regex too.