<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
<tt>Hi Diego,<br>
<br>
The REGEXPs in OpenSIPS are POSIX compliant, so \d are not
supported. Try:<span style="font-family: courier new,monospace;">
"^(.)?[0-9]{4}$</span>" .<br>
</tt><tt><br>
Regards,<br>
</tt>
<pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
<br>
On 05/20/2013 06:57 PM, Diego Barberio wrote:
<blockquote
cite="mid:CABKsyb4_-NtT-ZR40zDgKxTGY_zdy7TqP8c7kK5toYZuHL1n5Q@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
<div>
<div>Hi All,<br>
<br>
</div>
I'm having a really stupid issue with opensips 1.8.1. I
need to do different logic if the request line user is a
number of 4 digits that can be preceded by any character.
So I created this regular expression: ^(.)?\d{4}$<br>
</div>
I've tested it on <a moz-do-not-send="true"
href="http://www.regular-expressions.info/javascriptexample.html">www.regular-expressions.info/javascriptexample.html</a>
and works perfect, however on opensips it never matches.<br>
<br>
</div>
I've made the following test script:<br>
<br>
<span style="font-family: courier new,monospace;"><br>
if($rU =~ '^(.)?\d{4}$') {<br>
xlog("MATCHES $rU\n");<br>
}else{<br>
xlog("NOT MATCHES $rU\n");<br>
}</span><br>
<br>
</div>
And I always get "NOT MATCHES":<br>
<span style="font-family: courier new,monospace;"><br>
May 20 11:54:33 localhost /usr/local/sbin/opensips[22628]: NOT
MATCHES *5522 <br>
May 20 11:54:42 localhost /usr/local/sbin/opensips[22629]: NOT
MATCHES 5522 </span><br>
<div>
<div><br>
</div>
<div>What am I doing wrong?<br>
<br>
</div>
<div>Thanks<br>
</div>
<div>Diego<br>
</div>
<div><br>
</div>
</div>
</div>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
</body>
</html>