tags:

views:

66

answers:

3

Hi there,

I have two cases to match: either

# ... ([0-9]+,[0-9]+) € ... #

or

# ... (--) ... #

Now,

# ... (?:(--)|([0-9]+,[0-9]+) €) ... #

isn't working, it says

Unknown modifier '(' ...

I'm using preg_match_all() on PHP 5.3

Those above are NOT the full expressions, just extracts!

A: 

You need to put the plain regular expressions in delimiters to get a regular expression in PCRE format, for example with / as delimiter:

/(?:(--)|([0-9]+,[0-9]+) €)/
Gumbo
A: 

Have you put the delimiters?

preg_match_all('#(?:(--)|([0-9]+,[0-9]+) €)#', ...)

instead of

preg_match_all('(?:(--)|([0-9]+,[0-9]+) €)', ...)
yuku
of course I'm using delimiters... I posted just an extract of the regexp...
janoliver
A: 

Your regular expression works without errors:

 $p = "/(?:(--)|([0-9]+,[0-9]+) €)/";
 echo preg_match($p, "--")."\n";                // outputs 1
 echo preg_match($p, "nomatch")."\n";           // outputs 0

Please post your PHP code so we can identigy the problem

Tomas
the code is a little too complex, for it builds the complete expression in loops and so on. But I found the bug, I was using | as delimiters, what I completely fogot.
janoliver