Hi
I'm starting to learn regex and I'm having some problems using it in custom filters. It seems to ignore some regex patterns.
For example:
Text:
afoo bfoo abc acb bca bac
With this search:
/(a|b)(?=foo)/
doesn't match anything.
Where is the problem? Is custom filter using some kind of cut search patterns set?
Comments
Comment #1
mradcliffe/([ab]foo?)/iIf i replace everything with the word blah this gives meblah blah blahblahc blahcblah blahcblah blahblahcI was browsing around and came across this issue so I thought I'd try to help out.
Comment #2
NoRandom commentedWith your example, /[a|b](foo)/ also seems to work. So, I'm thinking the error is in my search using () instead of [].
I use regex buddy wich helps me a lot to learn and check my search patterns but maybe it's too permissive.
Kind regards.
PD.- Anyway, I tried sometimes to build maybe too long search patterns.
Comment #3
avpaderno/[a|b](foo)/is quiet different from/(a|b)(foo)/;[a|b]would matcha, orb, or|while(a|b)matchesa, orb.Comment #4
NoRandom commentedMy mistake, KiamLaLuno, sorry.
Anyway, I use Regex Buddy to check my search expresions. Some times the search works in regex buddy and doesn't in custom filter.
Comment #5
avpadernoThat is strange; they declare to support PHP regular expressions.
The only way I know to verify the regular expression is really working is to test it in PHP code. Take in mind that this module uses PCRE regular expressions, which are different from ereg expressions, and from Perl regular expressions.
Comment #6
NoRandom commentedI don't have access right now to regex but as soon as I come back to my computer I try to put an example.
Kind regards.