I'm using this regex to mach some words without numbers and it works well
(?:searchForThis|\G).+?(\b[^\d\s]+?\b)
The problem that Regex searching the entire document and not only in the line that contains searchForThis
So if I have 2 times searchForThis it will take them twice
I want to stop it only on that 1st line so it will not search the other lines after Any help please?
I'm using Regex with php
Example of the problem here: http://www.rubular.com/r/vPhk8VbqZR
In the example you will see :
Match 1
1. word
Match 2
1. worldtwo
Match 3
1. wordfive
Match 4
1. word
Match 5
1. worldtwo
Match 6
1. wordfive
But I need only :
Match 1
1. word
Match 2
1. worldtwo
Match 3
1. wordfive
You will see that it's doing twice
===========Edit for more details as asked ===========================
In my php I have :
define('CODE_REGEX', '/(?:searchForThis|\G(?<!^)).*?(\b[a-zA-Z]+\b)/iu')
Output :
if (preg_match_all(CODE_REGEX, $content, $result))
return trim($result[1][0].' '.$result[1][1].' '.$result[1][2].' '.$result[1][3].' '.$result[1][4].' '.$result[1][5]);
Thank you