[Phpwm] mysql search / replace
Phil Beynon
phil at infolinkelectronics.co.uk
Mon Oct 8 15:02:52 BST 2007
> I think mysql regex function is only for comparison so you cant
> use it as a select modifier.
>
> You could use preg to clean the data as it comes out of the db like:
>
> $result = preg_replace('/\\s{2,}/', '', $subject);
>
> You may be able to do it at the mysql server using a procedure or
> routine. Have a look on the mysql forge there may be some ready made.
>
>
> Keith Pope
> Web Developer
Hi Keith,
I'm not sure, in that its not actually modifying anything as such, the
REPLACE() is doing that, the REGEX _should_ just be acting as a filter on
the initial selection, if of course REPLACE() will allow the useage of
expressions within that part.
Certainly you can apply regular expressions once the data is externalised
from MySQL, but you still have to be able to select the correct data, which
means being able to select a multiple set of spaces in some form. I'm
wondering how it actually stores it, I'm begining to think it must be
something like a multi-byte chr$ type code and to match against that. I may
be mixing languages here but I think chr$(32) or something similar is the
code for a space, but I'm going to have to lok that one up! :-)
Phil
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.488 / Virus Database: 269.14.4/1056 - Release Date: 07/10/2007
18:12
More information about the Phpwm
mailing list