[PHP] regular expressions help please

2002-04-30 Thread Ed Lazor
I've been banging my head against regular expressions all night... help would be greatly appreciated. Could you give me examples on how to do the following? Pull everything except a specific word from a sentence. For example, pulling everything except the word run from the water run was

Re: [PHP] regular expressions help please

2002-04-30 Thread Jason Wong
On Tuesday 30 April 2002 15:51, Ed Lazor wrote: I've been banging my head against regular expressions all night... help would be greatly appreciated. Could you give me examples on how to do the following? Is this for a programming assignment/exercise? Do you /have/ to use regex? Other

[PHP] regular expressions help please

2002-04-30 Thread John Fishworld
I'm trying to find files in my array for example =lg_imode.gif and =/db/imodeklein/edgar-IMODE-1-.gif I want to differentiate between the files with slash at the front and ones without so that I can add a server path ! but as usual I' m having problems with the correct regex At the moment I've

RE: [PHP] regular expressions help please

2002-04-30 Thread Ford, Mike [LSS]
-Original Message- From: John Fishworld [mailto:[EMAIL PROTECTED]] Sent: 30 April 2002 09:32 I'm trying to find files in my array for example =lg_imode.gif and =/db/imodeklein/edgar-IMODE-1-.gif I want to differentiate between the files with slash at the front and ones

Re: [PHP] regular expressions help please

2002-04-30 Thread Jason Wong
On Tuesday 30 April 2002 16:31, John Fishworld wrote: I'm trying to find files in my array for example =lg_imode.gif and =/db/imodeklein/edgar-IMODE-1-.gif Perhaps you should clarify your problem. First of all does your array contain just gif files (ie *.gif) or does it contain all sorts

Re: [PHP] regular expressions help please

2002-04-30 Thread John Fishworld
Okay right I'm experimenting with an i-mode parser ! I copy the file (url entered) to a local location ! Then read through the whole file line at a time and change/replace the things that need replaceing ! On of the things that I need to replace is the links to the pictures so that they still

Re: [PHP] regular expressions help please

2002-04-30 Thread Jason Wong
On Tuesday 30 April 2002 19:17, John Fishworld wrote: Okay right I'm experimenting with an i-mode parser ! I copy the file (url entered) to a local location ! Then read through the whole file line at a time and change/replace the things that need replaceing ! On of the things that I need to

Re: [PHP] regular expressions help please

2002-04-30 Thread John Fishworld
$imode_code = file($url_file); $file_name = basename($url_file); $path = dirname($url_file); $stripped_path = eregi_replace(^(.{2,6}://)?[^/]*/, , $path); $next_path = eregi_replace($stripped_path, , $path); $next_path_1 = eregi_replace(/$ , , $next_path); // create and open a file to write to

Re: [PHP] regular expressions help please

2002-04-30 Thread Jason Wong
On Tuesday 30 April 2002 19:43, John Fishworld wrote: $imode_code = file($url_file); $file_name = basename($url_file); $path = dirname($url_file); $stripped_path = eregi_replace(^(.{2,6}://)?[^/]*/, , $path); On Tuesday 30 April 2002 19:17, John Fishworld wrote: Okay right I'm

Re: [PHP] regular expressions help please

2002-04-30 Thread John Fishworld
Duh ! lol sorry ! Example 1 html head meta http-equiv=content-type content=text/html;charset=iso-8859-1 meta name=generator content=Edit Plus titleLocations/title /head body bgcolor=#6699FF div align=center pfont color=blackWelcome tobr /fontfont color=redimg src=lg_imode.gif alt=

Re: [PHP] regular expressions help please

2002-04-30 Thread Miguel Cruz
On Tue, 30 Apr 2002, Ed Lazor wrote: Pull everything except a specific word from a sentence. For example, pulling everything except the word run from the water run was steep. $str = 'the water run was steep'; print preg_replace('/(\s*water)/', '', $str); Pull all words from a string

Re: [PHP] regular expressions help please

2002-04-30 Thread Jason Wong
On Tuesday 30 April 2002 21:09, John Fishworld wrote: Duh ! lol sorry ! img src=/db/imodeklein/edgar-IMODE-1-.gif vspace=2br#59091;nbsp;a href=imode.fpl?op=imodecardprefix=IMODEnummer=1suffx=uid=55%2eFAGAEpa Unfortunately, no. Could you post say 20 lines of this file you're talking

Re: [PHP] regular expressions help please

2002-04-30 Thread John Fishworld
Thanks after playing about with that I've got the following which does seem to work ! $imode_code[$i] = eregi_replace((src=)(\)([a-z0-9_\/-]+\.gif)(\), \\1\\2$path/\\3\\2, $imode_code[$i]); Very very very slowly getting the hang of regexs ! What does your /i do at the end ??? Thanks Try

Re: [PHP] regular expressions help please

2002-04-30 Thread Miguel Cruz
On Wed, 1 May 2002, John Fishworld wrote: Thanks after playing about with that I've got the following which does seem to work ! $imode_code[$i] = eregi_replace((src=)(\)([a-z0-9_\/-]+\.gif)(\), \\1\\2$path/\\3\\2, $imode_code[$i]); Very very very slowly getting the hang of regexs !

Re: [PHP] regular expressions help please

2002-04-30 Thread John Fishworld
aha ! thats very strange then because mine works at the moment but if I add the /i at the end then it doesn't ! On Wed, 1 May 2002, John Fishworld wrote: Thanks after playing about with that I've got the following which does seem to work ! $imode_code[$i] =

Re: [PHP] regular expressions help please

2002-04-30 Thread Miguel Cruz
I wasn't paying that much attention. The /i is a preg thing. It's the same as changing from ereg to eregi. miguel On Wed, 1 May 2002, John Fishworld wrote: aha ! thats very strange then because mine works at the moment but if I add the /i at the end then it doesn't ! On Wed, 1 May 2002,