Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Regular Expression Help With Phone Number

Guest
Aug 08, 2006 Aug 08, 2006
I have a sentence, for example, "My telephone number is (717) 999-9834". What would be the regex expression to just extract the area code, in this case, 717. I have gotten as far as a regex that gets (717), but need help stripping out the (). Here is what i have so far:

Thanks for your help.
312
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 09, 2006 Aug 09, 2006
Hi aparsons ,
You can get your area code , using the string function MID(string,start , count) as following way:

<cfoutput>
#mid(mysentence,a_ac1+1,3)#
</cfoutput>
since a_ac1 has the starting index of the ( ,so you have to start one character ahead , and count = 3 since your area code of 3 character

Thanks.

Prashant Gupta,
prashantgenial@gmail.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 09, 2006 Aug 09, 2006
LATEST
Ok. Yeah, I guess that will work. I was trying to keep it on one line of code.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources