Home » Php » PHP Lookbehind Regex

PHP Lookbehind Regex

Posted by: admin February 25, 2020 Leave a comment

Questions:

I am looking for not matching previous word..
Example: “PrevNot MyWord”;

Now below code can check last word only if one space is in between.

(?<!PrevNot\s)MyWord

But it not working if there are more then one space..

Example: “PrevNot MyWord”
How can i check last not match by ignoring space?

How to&Answers: