aboutsummaryrefslogtreecommitdiffstats
path: root/funcs
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-08 16:44:38 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-08 16:44:38 +0000
commit411f01b40e15f0d398957f4e08824617e7b162b8 (patch)
treed8bd6cf5f7fae57917a102c804497e5b94073136 /funcs
parent3155a9acdc1813a1a50eb5d05737a3efb76cd31e (diff)
As per discussion on bug 7862, the problem wasn't the fact that the documentation differed from behavior, but rather that users are used to REGEX having that space after the double quote in 1.2.x. So, in keeping with history, I investigated a little deeper, and discovered that the change in behavior was due to the modification of the function to use the AST_DECLARE_APP_ARGS and AST_NONSTANDARD_APP_ARGS() to parse the args. The code to skip the blank was left out. So, what I did was add code to throw out the first blank (space or tab) after the double quote, IF IT IS THERE. If not, nothing is done.Verbage is added to the function description saying that the space is optional, and skipped if it is there. If a space is desired, then the documentation advises putting two spaces there. This should make it compatible for 1.2 users, and not mess up new users who are used to using it with no space. It WILL mess up new users who WANT a space. Hopefully, they will double check the doc strings for this func and add the extra space. Hopefully, this class of new user is very small.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@42423 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_strings.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/funcs/func_strings.c b/funcs/func_strings.c
index e330738a2..e9abe50c2 100644
--- a/funcs/func_strings.c
+++ b/funcs/func_strings.c
@@ -123,6 +123,8 @@ static int regex(struct ast_channel *chan, char *cmd, char *parse, char *buf,
ast_log(LOG_ERROR, "Unexpected arguments: should have been in the form '\"<regex>\" <string>'\n");
return -1;
}
+ if ((*args.str == ' ') || (*args.str == '\t'))
+ args.str++;
ast_log(LOG_DEBUG, "FUNCTION REGEX (%s)(%s)\n", args.reg, args.str);
@@ -144,10 +146,10 @@ static struct ast_custom_function regex_function = {
.synopsis = "Regular Expression",
.desc =
"Returns 1 if data matches regular expression, or 0 otherwise.\n"
- "Please note that the double quotes separating the expression from the data\n"
- "should not have any neighboring spaces, either before or after, unless you\n"
- "intend them to be in either the expression or the data!\n",
- .syntax = "REGEX(\"<regular expression>\"<data>)",
+ "Please note that the space following the double quotes separating the regex from the data\n"
+ "is optional and if present, is skipped. If a space is desired at the beginning of the data,\n"
+ "then put two spaces there; the second will not be skipped.\n",
+ .syntax = "REGEX(\"<regular expression>\" <data>)",
.read = regex,
};