Re: Regex problem..

2005-07-25 Thread Lamont R. Peterson
On Monday 25 July 2005 01:56pm, Michael Stassen wrote:
> Gregory Machin wrote:
> > Hi.
> >
> > Please could you advise me...
> > I have php pages that are stored in a mysql database, that will later
> > be imported into a cms
> > I want to use mysql's regex funtion to remove unwanted php code and
> > update links to images
> > and urls.
> >
> > But i cant seem to get my brian around the regex part ...
> >
> > i want to remove the header include 
> > i tried <\?php[^>][header1].*\?> , and other attempts but no luck ..
> > unfortunetly i can do a normal string replace because of varations,in
> > the code ...

This regex would not match your case.  Try this on for size:

<\?php.*require.*header1.*\?>

> > Many Thanks
>
> MySQL's REGEX is only for matching, not for replacement.  If you really
> need a regex search and replace, you may find it easier to dump your data,
> edit it, and reimport it.  If you are determined to do it in mysql, you'll
> need a (probably ugly) combination of mysql string functions.  See the
> manual for details:
>
> 
> 

As Michael suggests, better to do this in an app.  It should not take you very 
long to write a quick data importer in PHP that would take care of all this 
including using preg_replace () where you want it.
-- 
Lamont R. Peterson <[EMAIL PROTECTED]>
Founder [ http://blog.openbrainstem.net/peregrine/ ]
OpenBrainstem - Intelligent Open Source Software Engineering


pgpzhFjg8ymNz.pgp
Description: PGP signature


Re: Regex problem..

2005-07-25 Thread Michael Stassen

Gregory Machin wrote:


Hi.

Please could you advise me...
I have php pages that are stored in a mysql database, that will later
be imported into a cms
I want to use mysql's regex funtion to remove unwanted php code and
update links to images
and urls.

But i cant seem to get my brian around the regex part ...

i want to remove the header include 
i tried <\?php[^>][header1].*\?> , and other attempts but no luck ..
unfortunetly i can do a normal string replace because of varations,in
the code ...

Many Thanks


MySQL's REGEX is only for matching, not for replacement.  If you really need a 
regex search and replace, you may find it easier to dump your data, edit it, 
and reimport it.  If you are determined to do it in mysql, you'll need a 
(probably ugly) combination of mysql string functions.  See the manual for 
details:





Michael

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Regex problem..

2005-07-25 Thread Gregory Machin
Hi.

Please could you advise me...
I have php pages that are stored in a mysql database, that will later
be imported into a cms
I want to use mysql's regex funtion to remove unwanted php code and
update links to images
and urls.

But i cant seem to get my brian around the regex part ...

i want to remove the header include 
i tried <\?php[^>][header1].*\?> , and other attempts but no luck ..
unfortunetly i can do a normal string replace because of varations,in
the code ...

Many Thanks
-- 
Gregory Machin
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.linuxpro.co.za
Web Hosting Solutions
Scalable Linux Solutions 
www.iberry.info (support and admin)
www.goeducation (support and admin)
+27 72 524 8096

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]