Re: [PHP] preg_replace help

2010-01-26 Thread Kim Madsen
Michael A. Peters wrote on 26/01/2010 14:18: $fixSrch[] = '/\n/'; $fixRplc[] = '[br]'; is what I need except I want it to leave anything between [code] and [/code] alone. I figured it out before but with element /element but I don't even remember what I was working on when I did that and I

Re: [PHP] preg_replace help

2010-01-26 Thread Michael A. Peters
Kim Madsen wrote: Michael A. Peters wrote on 26/01/2010 14:18: $fixSrch[] = '/\n/'; $fixRplc[] = '[br]'; is what I need except I want it to leave anything between [code] and [/code] alone. I figured it out before but with element /element but I don't even remember what I was working on

Re: [PHP] preg_replace help

2010-01-26 Thread Michael A. Peters
Michael A. Peters wrote: Kim Madsen wrote: Michael A. Peters wrote on 26/01/2010 14:18: $fixSrch[] = '/\n/'; $fixRplc[] = '[br]'; is what I need except I want it to leave anything between [code] and [/code] alone. I figured it out before but with element /element but I don't even remember

[PHP] Re: PHP preg_replace help

2007-09-18 Thread Al
Just use stripslashes() on your submitted data and forget about testing for magic_quotes. It's good practice anyhow. \ is not legit text regardless. haim Chaikin wrote: Hello, I am a beginner in PHP. I need help with the function preg_replace. I am trying to remove the backslashes (

Re: [PHP] Re: PHP preg_replace help

2007-09-18 Thread Arpad Ray
Apologies if you already received this message, I tried to send it earlier from my webmail but it doesn't seem to have worked. Al wrote: Just use stripslashes() on your submitted data and forget about testing for magic_quotes. It's good practice anyhow. \ is not legit text regardless.

Re: [PHP] preg_replace() help

2007-07-14 Thread Richard Heyes
What am I doing wrong? Using regular expressions when you don't need to: $txt = str_replace(' ', 'nbsp;', substr($txt, strpos($txt, --))); Might be a few typos in there. And I may have mixed up the args. -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge

Re: [PHP] preg_replace() help

2007-07-13 Thread Jim Lucas
Rick Pasotto wrote: I have quotes like the following: $txt = 'A promise is a debt. -- Irish Proverb'; I'd like to replace all the spaces afer the '--' with nbsp; This is what I've tried: $pat = '/( --.*)(\s|\n)/U'; $rpl = '$1$2nbsp;'; while (preg_match($pat,$txt,$matches) 0)

Re: [PHP] preg_replace() help

2007-07-13 Thread Daniel Brown
On 7/13/07, Rick Pasotto [EMAIL PROTECTED] wrote: I have quotes like the following: $txt = 'A promise is a debt. -- Irish Proverb'; I'd like to replace all the spaces afer the '--' with nbsp; This is what I've tried: $pat = '/( --.*)(\s|\n)/U'; $rpl = '$1$2nbsp;'; while

Re: [PHP] preg_replace() help

2007-07-13 Thread Jim Lucas
Rick Pasotto wrote: I have quotes like the following: $txt = 'A promise is a debt. -- Irish Proverb'; I'd like to replace all the spaces afer the '--' with nbsp; This is what I've tried: $pat = '/( --.*)(\s|\n)/U'; $rpl = '$1$2nbsp;'; while (preg_match($pat,$txt,$matches) 0)

Re: [PHP] preg_replace() help

2007-07-13 Thread Richard Lynch
On Fri, July 13, 2007 3:52 pm, Rick Pasotto wrote: I have quotes like the following: $txt = 'A promise is a debt. -- Irish Proverb'; I'd like to replace all the spaces afer the '--' with nbsp; This is what I've tried: $pat = '/( --.*)(\s|\n)/U'; You might want to use \\s and \\n,

Re: [PHP] preg_replace help please

2003-09-24 Thread John W. Holmes
Justin French wrote: this is supposed to any occurrence of *something* into strongsomething/strong $str = preg_replace(!\*(.*?)\*!, strong\\1/strong\\2,$str); it works fine on single lines, but it breaks when there's a \n (and perhaps other white spaces?) in the string, eg: *something with a

Re: [PHP] preg_replace help

2003-06-04 Thread Jim Lucas
What do you mean by additional modifiers? Jim Lucas - Original Message - From: Jackson Miller [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 9:43 AM Subject: [PHP] preg_replace help I am trying to create a text only version of an HTML formatted message. I would

Re: [PHP] preg_replace help

2003-06-04 Thread Jackson Miller
On Tue, 2003-06-03 at 11:52, Jim Lucas wrote: What do you mean by additional modifiers? Some links may be in the format: a href=http://domain.tld/page.ext; target=target name=description of the linklink name/a I just want to ignore any of those modifiers in the text version. -Jackson Jim

Re: [PHP] preg_replace help

2003-06-04 Thread Ernest E Vogelsinger
At 18:43 03.06.2003, Jackson Miller said: [snip] I am trying to create a text only version of an HTML formatted message. I would like to convert all links from: a href=http://domain.tld.page.ext;link name/a to: link name [http://domain.tld/page.ext] The

Re: [PHP] preg_replace help

2003-06-04 Thread Ernest E Vogelsinger
At 18:43 03.06.2003, Jackson Miller said: [snip] I am trying to create a text only version of an HTML formatted message. I would like to convert all links from: a href=http://domain.tld.page.ext;link name/a to: link name [http://domain.tld/page.ext] The

Re: [PHP] preg_replace help

2003-06-04 Thread Jackson Miller
Maybe I should clarify. $message = 'pVisit a href=http://jaxn.org; target=_topMy personal site/a to learn more about me./p pVisit a href=http://memigo.com;memigi/a to learn about current events.'; What I want is to run a preg_replace to get the following: Visit My personal site (http://jaxn.org)

Re: [PHP] preg_replace help

2003-06-04 Thread Ernest E Vogelsinger
At 19:18 03.06.2003, Jackson Miller said: [snip] Maybe I should clarify. $message = 'pVisit a href=http://jaxn.org; target=_topMy personal site/a to learn more about me./p pVisit a href=http://memigo.com;memigi/a to learn about current events.'; What I

RE: [PHP] preg_replace help

2002-01-12 Thread Boaz Yahav
Here are some scripts to help you : http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=1235 http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=1234 http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=1401

Re: [PHP] preg_replace help

2002-01-11 Thread mike cullerton
on 1/11/02 8:20 PM, Gaylen Fraley at [EMAIL PROTECTED] wrote: Can someone recommend a good tutorial or book on this subject? Mastering Regular Expressions Jeffrey Friedl O'Reilly Associates ISBN 1-56592-257-3 -- mike cullerton -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] preg_replace help

2002-01-11 Thread Jimmy
Hi Gaylen, Please visit my web site at a href=http://www.mysite.comwww.mysite.com/a. You will be glad you did! assumming all link start with www and all word which start with www must be a link: $repLink = preg_replace(/ (www[^ ]*) /i, a href='http://\\1'\\1/a,