Parsing Phone Number out of String
Greetings,
I have a varchar column called "Name" that was poorly implemented and contains the user name AND their phone number in the same column and I want to parse out the phone number and return just the Name.
Ex. "Jeff Standard (123) 456-7890"
Desired Result: "Jeff Standard"
Another dilemma is the phone numbers are entered in an inconsistent manner, they could be of any of these formats:
(xxx) xxx-xxxx
xxx-xxx-xxxx
xxx xxx-xxxx
I was looking at creating this as a stored procedure and calling it from Excel to load it into a reporting template.
I've fiddled around with REGEXPs but unfortunately they are for pattern MATCHING and I can't find a decent way to apply them to parse out the phone number portion of the string, only filter it.
I'm fairly new to MySQL, please bear with me.
Thanks,
- Jeff