PREG_RLIKE

Test if a string matches a perl-compatible regular expression

Function Installation
CREATE FUNCTION preg_rlike RETURNS INTEGER SONAME 'lib_mysqludf_preg.so';
Synopsis
PREG_RLIKE( pattern , subject )
Parameters:
pattern - is a string that is a perl compatible regular expression as documented at: http://us.php.net/manual/en/ref.pcre.php This expression passed to this function should have delimiters and can contain the standard perl modifiers after the ending delimiter.
subject - is the data to perform the test on.
Returns:
1 - a match was found

0 - no match

preg_rlike is a udf that tests if whether or not the given perl compatible regular expression matches the given data.

Examples:
SELECT PREG_RLIKE('/The quick brown fox/i' , 'the quick brown fox' );

Yields:

   +---------------------------------------------------------------+
   | PREG_RLIKE('/The quick brown fox/i' , 'the quick brown fox' ) |
   +---------------------------------------------------------------+
   |                                                             1 |
   +---------------------------------------------------------------+
 * 

SELECT * from products WHERE PREG_RLIKE( '/organic/i' , products.title )

Yields: all of the products with 'organic' in their titles


Generated on Fri Sep 7 16:51:44 2007 for lib_mysqludf_preg by  doxygen 1.4.6