Do you know any easy way to remove (or replace) all non alphanumeric characters from varchar variable in Mysql?
something like String\'s replaceAll(\"[^a-zA-Z0-9]\",
this is the solution in sql server. But the concept goes like I have created a number table and splitted the charecters and then matching those against the regular expression.
Hope the same concept can be portrayed in mysql with a bit change and that hopefully u can do.
declare @str varchar(50)
set @str = '1ab3^45)(*%'
declare @NumberTable table(id int)
insert into @NumberTable(id) values(1)
insert into @NumberTable(id) values(2)
insert into @NumberTable(id) values(3)
insert into @NumberTable(id) values(4)
insert into @NumberTable(id) values(5)
insert into @NumberTable(id) values(6)
insert into @NumberTable(id) values(7)
insert into @NumberTable(id) values(8)
insert into @NumberTable(id) values(9)
insert into @NumberTable(id) values(10)
insert into @NumberTable(id) values(11)
insert into @NumberTable(id) values(12)
select NonAlphaChars = SUBSTRING(@str,id,1) from @NumberTable
where SUBSTRING(@str,id,1) like '%[^a-z0-9]'
NonAlphaChars
^
)
(
*
%