lua-users home
lua-l archive

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


Hi,
 
But the part that is complicated is that area code can have different number of digits, such as 1 or 851 or 852
Based on the country code, area code can be 2 -3 digits long.
For instance, if the country code is 852, there is no area code.  If the country code is 1, then area code is 3 digits.
 
The part that simplifies my life is that there is only 3 different country codes that will appear in the string.  So, I only need to use .find to identify one of those three and then do a .find on the substring to identify the area code, which is a limited set of all available area codes.
 
Definitely, it would be best to have a function to handle all available country code and area code breakdown, but I doubt if one exists.  If not, what is the best way for this limited solution I am solving?
 
For regex, I think it assumes a certain number of digits for each part.  If the number of digits is variable but is contained in a "set", is it possible to do it efficiently in lua?
 
Thanks alot in advance for your kind suggestion.
 
Regards,
Pete