Hi Daniel,
Thanks for your response. I just looked into the code myself (could have done that before
I guess) and I indeed see it is just taking the first 500 chars at the moment. A patch to
extend the limit will be nice but I can live just fine with that 500 limit as long as the
module generates an error when you have larger lines in your regex group.
Regards,
Tim
-----Oorspronkelijk bericht-----
Van: sr-users [mailto:sr-users-bounces@lists.sip-router.org] Namens Daniel-Constantin
Mierla
Verzonden: donderdag 23 maart 2017 19:09
Aan: Kamailio (SER) - Users Mailing List
Onderwerp: Re: [SR-Users] Regex module having trouble with large regex expressions in
kamailio 4.4.5
Hello,
looking quickly at the code, I see that there is a define of 500 limit for each line
loaded from the file, probably it is what the developer considered to be enough for a
regexp. I haven't gone further checking, as I am out of the office, but I guess it
just truncates the longer lines to the limit.
So it would require a patch to extend that.
Cheers,
Daniel
March 23, 2017 9:05 AM, "Tim Balmer" <t.balmer(a)edutel.nl> wrote:
Hi,
I discovered some strange behavior from the regex module yesterday (kamailio version
4.4.5).
For example we have the phone number 0033755500381 that we try to
match with the following kamailio
code:
#!define REGEX_FF_NEG_INTERNATIONAL "6"
...
if (pcre_match_group("$rU", REGEX_FF_NEG_INTERNATIONAL)) { # Do
something }
When the content of our regex groups file is like this:
[6]
^(\+|00)3(0690|0693|0694|0695|0697|0698|0699|36|37|4160|46|47|51160|51
1691|511693|511696|511891|5118
3|511896|513|516091|5160921|516093|516096|516391|516392|516393|516396|516591|516592|516593|516596|51
691|5166921|516693|516696|5191|5192|5193|5196|538|54388|543
89|546|5475|5477|548|567117|5672|5677|5679|5692|5694|5696|5698|5699|5795|5796|5797|5799|58299|584|58
0|5948|5987|5988|5989|59988|59989|620|630|631|670|706|712|725|728|774|776|8591|8592|8595|8597|8598|8
99|8620|8621|8630|8631|8640|8641|8643|8649|8650|8651|8660|
8661|8664|8670|8671|869814|906698|93)
The above if statment is not matching, although it should match
according to any regex validator (for example
https://regex101.com )
But when I split the above regex in smaller parts, like this:
[6]
^(\+|00)306(90|93|94|95|97|98|99)
^(\+|00)336
^(\+|00)337
^(\+|00)34160
^(\+|00)346
^(\+|00)347
^(\+|00)351(160|1691|1693|1696|1891|1893|1896|3|6091|60921|6093|6096|6
391|6392|6393|6396|6591|6592|6
93|6596|6691|66921|6693|6696|91|92|93|96)
^(\+|00)3538
^(\+|00)354(388|389|6|75|77|8)
^(\+|00)356(7117|72|77|79|92|94|96|98|99)
^(\+|00)357(95|96|97|99)
^(\+|00)358(299|4|50)
^(\+|00)359(48|87|88|89|988|989)
^(\+|00)3620
^(\+|00)363(0|1)
^(\+|00)3670
^(\+|00)3706
^(\+|00)3712
^(\+|00)372(5|8)
^(\+|00)377(4|6)
^(\+|00)385(91|92|95|97|98|99)
^(\+|00)386(20|21|30|31|40|41|43|49|50|51|60|61|64|70|71|9814)
^(\+|00)3906698
^(\+|00)393
Then the exact same regex module call as before does result in a match as expected.
So to me it looks like the regex module is having trouble with large
regex expressions, I did check the logs but there is nothing strange
there, that means also the large expression is correctly loaded
according to the logs while in fact it is not working. Checked the regex module
documentation but there I cannot find any limits regarding to the size of invididual
expressions.
Is it me missing something or did I discover a bug in de regex module?
Best Regards,
Tim Balmer
Edutel BV
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
list sr-users(a)lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla
www.kamailio.org --
www.asipto.com
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users(a)lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users