0
Regular Expression Help With Phone Number

/t5/coldfusion-discussions/regular-expression-help-with-phone-number/td-p/61440
Aug 08, 2006
Aug 08, 2006
Copy link to clipboard
Copied
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.
Thanks for your help.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
/t5/coldfusion-discussions/regular-expression-help-with-phone-number/m-p/61441#M6335
Aug 09, 2006
Aug 09, 2006
Copy link to clipboard
Copied
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
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/coldfusion-discussions/regular-expression-help-with-phone-number/m-p/61442#M6336
Aug 09, 2006
Aug 09, 2006
Copy link to clipboard
Copied
Ok. Yeah, I guess that will work.
I was trying to keep it on one line of code.

Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

