Some Regex patterns doesn't work
Macarro - June 22, 2008 - 12:38
| Project: | Custom filter |
| Version: | 5.x-1.2 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
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?

#1
/([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.
#2
With 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.
#3
/[a|b](foo)/is quiet different from/(a|b)(foo)/;[a|b]would matcha, orb, or|while(a|b)matchesa, orb.#4
My 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.
#5
That 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.
#6
I 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.
#7
Automatically closed -- issue fixed for 2 weeks with no activity.