In MySQL I need to remove all single characters from a string:
"A Quick Brown B C D Fox" -> "Quick Brown Fox"
Any tips ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You want
[[:<:]]and[[:>:]]to search for word boundries in MySQL. (It would be\bin other regular expressions, PERL, grep, etc.)So…
'[[:<:]][a-zA-Z0-9][[:>:]]'Would find any single character.
OK TRY THIS…
This is based upon the function above, but hardcoded to look for single characters. I don’t claim this to be much more than a hack. But if you need to get the job done, and you cant install the external libraries for whatever reason, it won’t slow you down on strings that do NOT have any single characters to replace: