On Wednesday 29 May 2002 06:55, Kevin Stone wrote:
> All I need to do is return anything matching the following pattern from a
> specific column in a table. This is how I'd write it in PHP if I were
> pulling the data from string. The string in this example is a direct copy
> of one of the column fields..
>
> <?
> $str = "teaspoon_3 legends_3 lore_3 einstein_3 recipes_2 cups_2 plaster_2
> paris_2";
>
> // Search for einstein in the string and return the number associated with
> that word.
> preg_match_all("'einstein_(\d)'", $str, $matches);
> ?>
>
> What would be the SQL equivilant? I hate to seek a hand out here.. but I'm
> struggling with SQL REGEX and there just aren't as many good examples out
> there as there are for PHP. The MySQL manual wasn't much help that's for
> sure. :-\
It doesn't seem possible. The MySQL REGEXP only returns a 1 or 0 to indicate a
match or no match.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
You can't cheat an honest man. Never give a sucker an even break or
smarten up a chump.
-- W.C. Fields
*/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php