#214 Regexp support in transformations

trunk
closed-fixed
core (47)
7
2012-06-05
2012-03-30
Nick Altmann
No

Based on kamailio textops module regexp support in transformations implementation by Elena-Ramona Modroiu (asipto.com).

{re.subst,expression}
Perform Perl-like substitutions on string value pseudo-variables.
# Assign Request-URI user to PV
$var(user) = $(ru{re.subst,/^sip:(.*)@(.*)/\1/});
# Assign Request-URI user to PV, where every 'A' has been replaced by 'a'
$var(user) = $(rU{re.subst,/A/a/g});
The prototype is:
{re.subst,/match_expression/replacement_expression/flags}
match_expression - Posix regular expression
replacement_expression - substitution expression with back references to matched tokes: \1, \2, …, \9
flags:
i - match ignore case
s - match within multi-lines strings
g - replace all matches

Discussion

    • priority: 5 --> 7
     
    • assigned_to: nobody --> vladut-paiu
     
  • Hello,

    Patch was heavily re-worked and functionality is available on OpenSIPS trunk.

    Regards,
    Vlad

     
    • status: open --> closed-fixed