[Asterisk-Users] Regular expression matching for ":" - examples needed

John Todd jtodd at loligo.com
Thu Sep 4 17:12:53 MST 2003


It is again perhaps my recent spate of bad sleeping that has 
prevented my brain from wrapping around this explanation, or it is 
perhaps my inherent hatred of regular expression syntax.  However, I 
have been unable to put this into a working form after staring at it 
for a while and trying different recipes.  If anyone wants to take a 
stab at this, I'd appreciate it.

(from README.variables)
expr1 : expr2
              The `:' operator matches expr1 against expr2, which must be a
              regular expression.  The regular expression is anchored to the
              beginning of  the string with an implicit `^'.

              If the match succeeds and the pattern contains at least one regu-
              lar expression subexpression `\(...\)', the string correspond-
              ing to `\1' is returned; otherwise the matching operator
              returns the number of characters matched.  If the match fails and
              the pattern contains a regular expression subexpression the null
              string is returned; otherwise 0.


Examples I'd like to see:

1)
  ${FOO} contains 12345#
  ${HASH} contains #

  If ${FOO} contains the contents of ${HASH} anywhere, go to 2. If not, goto 102

exten=> 123,1,GotoIf($[...???...]?2|102)


1.1)
   If the last digit of ${FOO} is ${HASH}, then goto 2.  If not, goto 102.


exten => 123,1,GotoIf($[...???...]?2|102)



JT



More information about the asterisk-users mailing list