Hello
I have a question about the REPLACE string function, not the REPLACE SQL
command.
According to the documentation, REPLACE works as follows:
==========
REPLACE(str,from_str,to_str)
Returns the string str with all all occurrences of the string from_str
replaced by the string to_str
mysql> select REPLACE('www.mysql.com', 'w', 'Ww');
-> 'WwWwWw.mysql.com'
==========
Is there any way to make this REPLACE function match regular expressions
rather than substrings? Lets say, if you wanted to remove all
non-alhpabetic characters from a column, you could do:
select REPLACE(Address, '[^A-Za-z]', '');
so that '123 Somestreet' becomed 'Somestreet'?
The real usefullness of this, for me, is to be able to group rows together
by similarities in their columns. For example:
select REPLACE(Address, '[^A-Za-z]', '') as StreetName, COUNT(*) from
Addresses group by StreetName;
which would return something like this:
+-------------+----------+
| Street Name | COUNT(*) |
+-------------+----------+
| Somestreet | 5 |
| Apple Ct | 2 |
+-------------+----------+
Thanks in advance for any help. At the worst case, I guess this is a
request for a feature.
Tim
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Tim Gustafson - [EMAIL PROTECTED] http://www.falconsoft.com/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Share your knowledge - it's a way to achieve immortality.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php