[Home]

Summary:ASTERISK-06502: Dialplan Function REGEX not behaving correctly
Reporter:E. Versaevel (erikje)Labels:
Date Opened:2006-03-08 09:08:10.000-0600Date Closed:2008-01-15 17:43:11.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Functions/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:The REGEX dialplan function is using some wacky code to determine the regexp and the data to regexp, by default the funtion searches the whole string between the () for the first " from the left and the first " from the right.

This causes regexp data which contains " to be included in the regexp, breaking it. The solution is to replace the earg = strrchr(arg, '"'); with earg = strchr(arg, '"'); (func_strings.c)

${BAR}="hello \"AAAAA\" afj"
IE REGEX("foo" ${BAR})

Result ins regexp: "foo hello "AAAAA "on data "afj"
Comments:By: Russell Bryant (russell) 2006-03-21 11:50:57.000-0600

this has been fixed in 1.2.  It should already work fine in the trunk.  Thanks!

By: Digium Subversion (svnbot) 2008-01-15 17:43:11.000-0600

Repository: asterisk
Revision: 13925

U   branches/1.2/funcs/func_strings.c

------------------------------------------------------------------------
r13925 | russell | 2008-01-15 17:43:11 -0600 (Tue, 15 Jan 2008) | 2 lines

fix REGEX on strings that contain quotes (issue ASTERISK-6502)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=13925