Escaping regex + character

Franks Andy (RLZ) IT Systems Engineer Andy.Franks at sath.nhs.uk
Fri Aug 23 00:02:01 CEST 2013


Hi All,
  Just a quick question - I've compiled FR3 with pcre regex libraries
and it's working ok. I just can't get it to escape plusses ( + ) though
I've tried between 0 and 6(!) backslashes but all result in:

ERROR: Failed compiling regular expression: bad range inside [] at
offset 10
(0) ERROR: Condition evluation failed because the value of an operand
could not be determined

It's the + in the character class I'm trying to escape. This is with two
backslashes (what I'd expect to work as it does with dots - \\.

(0)    ? if ("%{Email-Address}" =~
/^[a-z0-9_-\+]+(\.[a-z0-9_-\\\+])*@[a-z0-9_-\\\+]+(\.[a-z0-9_-\\\+]+)*(\
.[a-z]{2,4})$/)
(0)     expand: "%{Email-Address}" -> 'a+b at c.de'
ERROR: Failed compiling regular expression: bad range inside [] at
offset 10
(0) ERROR: Condition evluation failed because the value of an operand
could not be determined

The regex works ok without the plusses, if not including them in the
subject..

Thanks
Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20130822/f32dc0ec/attachment.html>


More information about the Freeradius-Users mailing list