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

// 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. :-\


PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to