I have the following regullar expression
preg_match_all('# \(?\d+ lenses\)?\s-\s\#GBP\#\d{1,3}.\d{1,2}#i', $this->CurrentPage, $arr_Temp);
The expression matches for the following :
90 Lenses - £27.00
or
(90 Lenses) - £27.00
The expression almost works fine, it returns an array as follows :
[0] => 90 lenses - #GBP#27.00
[1] => (180 lenses) - #GBP#54.00
The only problem is, it returns a '(' and ')' after lenses which I do not want it to do, and I have spent a while now trying to get it to return the word lenses only when the info '90 lenses' is between '(' and ')' as element [1] indicates in the array dump above.
I have highlighted the portion of the expression by embolding it above which I beleive is the problem, it is looking for one or none '(' or ')', when it finds one it returns it unfortunately.
Is there a way to modify the expression so it does not return the brackets when '90 Lenses' is between brackets?
Any help would be hugely appreciated!
Extra characters being returned from regexp
Moderator: General Moderators