C
Craig Buchanan
I need to strip the ()- and spaces from a telephone number. What is the
regular express pattern for this? "\(\)-"?
thanks
regular express pattern for this? "\(\)-"?
thanks
Brian Davis said:Try this:
PhoneNumber = Regex.Replace(PhoneNumber, "[()-]","")
Brian Davis
www.knowdotnet.com
Craig Buchanan said:I need to strip the ()- and spaces from a telephone number. What is the
regular express pattern for this? "\(\)-"?
thanks
'strip anything that isn't a number
PhoneNumber = Regex.Replace(PhoneNumber, "\D","")
Craig Buchanan said:that works. this too:
'strip anything that isn't a number
PhoneNumber = Regex.Replace(PhoneNumber, "[^0-9]","")
Brian Davis said:Try this:
PhoneNumber = Regex.Replace(PhoneNumber, "[()-]","")
Brian Davis
www.knowdotnet.com
Craig Buchanan said:I need to strip the ()- and spaces from a telephone number. What is the
regular express pattern for this? "\(\)-"?
thanks
Jay B. Harlow said:Craig,
Which can be shorted to:
'strip anything that isn't a number
PhoneNumber = Regex.Replace(PhoneNumber, "\D","")
However, yours & mine will clobber phone numbers that are words:
1-800-FOR-HELP
Hope this helps
Jay
Craig Buchanan said:that works. this too:
'strip anything that isn't a number
PhoneNumber = Regex.Replace(PhoneNumber, "[^0-9]","")
Brian Davis said:Try this:
PhoneNumber = Regex.Replace(PhoneNumber, "[()-]","")
Brian Davis
www.knowdotnet.com
I need to strip the ()- and spaces from a telephone number. What is the
regular express pattern for this? "\(\)-"?
thanks
"\D" effectively means "[^0-9]"What does the \D mean?
Craig Buchanan said:Jay-
What does the \D mean?
Thanks,
Craig
Jay B. Harlow said:Craig,
Which can be shorted to:
'strip anything that isn't a number
PhoneNumber = Regex.Replace(PhoneNumber, "\D","")
However, yours & mine will clobber phone numbers that are words:
1-800-FOR-HELP
Hope this helps
Jay
isCraig Buchanan said:that works. this too:
'strip anything that isn't a number
PhoneNumber = Regex.Replace(PhoneNumber, "[^0-9]","")
Try this:
PhoneNumber = Regex.Replace(PhoneNumber, "[()-]","")
Brian Davis
www.knowdotnet.com
I need to strip the ()- and spaces from a telephone number. What
theregular express pattern for this? "\(\)-"?
thanks