Hi,
Thanks for the reply.Let me explain in more detail.I have a table of telephone codes/(All regular expressions like 0027[7-8] is South Africa).So my script takes a number say 0027215555555 and looks for it in a table and fins a match like so...
Code:
0027215555555 =~ ^0027[7-8]
This finds a match because the whole regular expression(0027[7-8]) exists in the number (0027215555555).
So my script runs fine normally,and matches the telephone numbers against the table of regular expression codes.
Here's my problem now.
I have been supplied with a list of codes from a proveder,and i need to match this against my regular expressions.Their codes is different from the ones a have.i.e for south africa they might only have a 0027.SO now i want to find all the matches for this 0027.
So,
Like in the above example the 0027215555555 becomes 0027.So if i do
It does not find a match because the whole regular expression (0027[7-8]) is not in the string.I want the script to realize that 0027 is only 4 digits long and therefore it must only look at the first 4 possible digits of the regular expression.
so i want 0027 to match the following
Code:
0027[7-8] #first 4 digits of reg expression contains 0027
0027[1] #first 4 digits of reg expression has 0027
0027[21][5-6] #first 4 digits of reg expression has 0027
00[2-6][7-9] #first 4 digits of reg expression does match 0027
etc
I hope this is more clear.Thanks for the help