Hylafax Mailing List Archives

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] request for help with regex for dialrules





Rance Hall wrote on 22/06/05 05:03 PM:

ive got my dial rules about 75% done

but im stuck on two points (which by the way, turn out to be the same problem)

I have two variables in my dialrules one is called localareas and the other is localexchanges

both have data of the format "123|456|789"

the issue is that we have a long distance access code that must be dialed after the main number is dialed if the call is long distance

based on the results of my dialrules tests I have the system building a complete phone number with the ld access code correctly

assume that hylafax dialrules can get me to the point where I have every number entered as 19185551212111

where the last three numbers are the ld access code we have discussed, also note that the ldsuffix is a variable in the dialrules script as well

I need a transformation that will return the existing value except for ldsuffix if the phone number matches the following regex

^1918(${localexchanges})[0-9]{4}4${ldsufix} assume 918 is the local area code, then assume that localechanges has the list of local exchanges, if the string expression matches this, then what needs to be returned is the original string minus the last ldsuffix variable

this is what I have and what it does:

^1918(${localexchanges})[0-9]{4}4${ldsufix}= \1

This only returns the local exchange I need it to return the localexchange and the number.
This seemed easier than a bunch of if then else statements to construct the number in one pass.


Based on vague recollections...

I think the \1 is returning only the localexchange because of the round brackets around ${localexchanges}

I think if you put another set of round brackets around [0-9]{4} then you would have a second block of matched stuff to play with after the = sign which you would access with \2. In other words, I think, just maybe, this is what you want:

^1918(${localexchanges})([0-9]{4})4${ldsufix}= \1\2

Or extend your existing pair of round brackets to include everything you want to use as \1 collectively and leave out \2.

Though I can't say that I see any use for the extra 4 you have before the second $. Just a typographical error? Or else I'm missing something about how your long distance code works.

Hope that helps.

can someone help me fix this please.

Thank you


____________________ HylaFAX(tm) Users Mailing List _______________________ To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services