RE: [PHP] preg_replace (underscore)

2002-10-28 Thread John Meyer
i've just used str_replace for underscores and it's worked wonderfully. -Original Message- From: Shawn McKenzie [mailto:nospam;mckenzies.net] Sent: Monday, October 28, 2002 4:46 PM To: [EMAIL PROTECTED] Subject: [PHP] preg_replace (underscore) Why does preg_replace(^\W^,,$str

[PHP] preg_replace pains

2002-06-27 Thread Richard Davey
Hi all, I've been having a wonderful night trying to solve this one, but I'm going to throw in the towel and see if anyone else can shed some light on it. The scenerio is quite simple, I'm parsing some form input from a user and looking for the following: [details]...[/details] where the

RE: [PHP] preg_replace pains

2002-06-27 Thread John Holmes
Wouldn't you want to use preg_match() before you replace it? www.php.net/preg_match ---John Holmes... -Original Message- From: Richard Davey [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 27, 2002 9:37 PM To: [EMAIL PROTECTED] Subject: [PHP] preg_replace pains Hi all, I've

Re: [PHP] preg_replace pains

2002-06-27 Thread Richard Davey
John Holmes [EMAIL PROTECTED] wrote in message 000a01c21e45$92b64270$b402a8c0@mango">news:000a01c21e45$92b64270$b402a8c0@mango... Wouldn't you want to use preg_match() before you replace it? In this instance, no I don't think so. I've already performed the task I needed with the tags in

Re: [PHP] preg_replace pains

2002-06-27 Thread Analysis Solutions
Hi Richard: On Fri, Jun 28, 2002 at 02:36:59AM +0100, Richard Davey wrote: [details]...[/details] $message = preg_replace('\[details\].*?', , $message); You didn't state what you want to get out of this exercise. To squash the detail tags and everything between them: $msg =

Re: [PHP] preg_replace pains

2002-06-27 Thread Paul Roberts
try $str = preg_replace(|\[details\].*?\[/details\]|si,, $str); drop the i if you want it case sensitive. Paul Richard Davey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, I've been having a wonderful night trying to solve this one, but I'm going

[PHP] preg_replace

2002-06-16 Thread Gerard Samuel
When you think you got it, you don't get it.. Im trying to scan the link for =A-Z0-9_=, dump the '=' and evaluate the remainder as a defined constant. Yes its funny looking, but if I could get this going Im golden. $bar is always returned with '=_L_OL_HERE=' as the link and not 'here' as it

[PHP] preg_replace - regex for replace string

2002-03-27 Thread James Taylor
I'm trying to do something to the effect of this for a preg_replace statement: $string = Hello\n\n\n\n\n\n\nHow are you?\n\n\n\n\n\n\n\nHi; $string = preg_replace(/\n\n/, /\n/, $string); But, it appears the 'replace' portion of the function doesn't allow for regex. How can I do this so that

Re: [PHP] preg_replace - regex for replace string

2002-03-27 Thread Miguel Cruz
On Wed, 27 Mar 2002, James Taylor wrote: I'm trying to do something to the effect of this for a preg_replace statement: $string = Hello\n\n\n\n\n\n\nHow are you?\n\n\n\n\n\n\n\nHi; $string = preg_replace(/\n\n/, /\n/, $string); But, it appears the 'replace' portion of the function

Re: [PHP] preg_replace - regex for replace string

2002-03-27 Thread James Taylor
This is just an example. There are some cases where I need the second option to be a regular expression, the same way that you can do in Perl regex... On Wednesday 27 March 2002 02:49 pm, you wrote: On Wed, 27 Mar 2002, James Taylor wrote: I'm trying to do something to the effect of this

Re: [PHP] preg_replace - regex for replace string

2002-03-27 Thread Miguel Cruz
On Wed, 27 Mar 2002, James Taylor wrote: On Wednesday 27 March 2002 02:49 pm, you wrote: On Wed, 27 Mar 2002, James Taylor wrote: I'm trying to do something to the effect of this for a preg_replace statement: $string = Hello\n\n\n\n\n\n\nHow are you?\n\n\n\n\n\n\n\nHi; $string =

Re: [PHP] preg_replace - regex for replace string

2002-03-27 Thread James Taylor
Ok, let me try to refine this as the big picture. User enters something into a form. We take that form value and convert newlines into br / though nl2br. Then, I want the limit the number of consecutive br /'s a user can enter, to avoid abuse via a person just holding down enter for a while.

Re: [PHP] preg_replace - regex for replace string

2002-03-27 Thread Miguel Cruz
On Wed, 27 Mar 2002, James Taylor wrote: Ok, let me try to refine this as the big picture. User enters something into a form. We take that form value and convert newlines into br / though nl2br. Then, I want the limit the number of consecutive br /'s a user can enter, to avoid abuse via

Re: [PHP] preg_replace - regex for replace string

2002-03-27 Thread James Taylor
Hm, nevermind my question :) I'm not thinking straight, not enough sleep. On Wednesday 27 March 2002 02:53 pm, you wrote: On Wed, 27 Mar 2002, James Taylor wrote: On Wednesday 27 March 2002 02:49 pm, you wrote: On Wed, 27 Mar 2002, James Taylor wrote: I'm trying to do something to the

Re: [PHP] preg_replace on digit word boundry in 2 lines how about 1?

2002-03-19 Thread Mahmoud
Hi, Don't know if it's the best way, but it works: ?php $digiword = 123joe123; $replace = preg_replace(/(\d)(\D)/,\\1,\\2,preg_replace(/(\D)(\d)/,\\1,\\2,$dig iword)); print $replace; ? will print 123,joe,123 Regards, Mahmoud -- PHP General Mailing List (http://www.php.net/) To

[PHP] preg_replace on digit word boundry help

2002-03-18 Thread Joe Rice
hi, i'm trying to replace ever digit nondigit boundary with a , in a string. i'm trying to get \d\D to be replaced with \d,\D and the reverse \D\d with \D,\d ... i'm not having any luck. $digiword = 123joe123 $replace = preg_replace(/(\d)(\D)/,\\1,\\2,$digiword); this ends up with

Re: [PHP] preg_replace on digit word boundry in 2 lines how about 1?

2002-03-18 Thread Joe Rice
i can do this if i do it in two line..i'm wondering if it can be done in 1 line. the two lines: $replace = preg_replace(/(\d)(\D)/,\\1,\\2,$digiword); $replace = preg_replace(/(\D)(\d)/,\\1,\\2,$replace); tia, joe Joe Rice([EMAIL PROTECTED])@Mon, Mar 18, 2002 at 12:39:17PM -0600: hi,

Re: [PHP] preg_replace() ??

2002-03-01 Thread DL Neil
Monty, Is preg_replace() the best PHP command to use for parsing custom codes in text retrieved from a database (e.g., turning [link= ] into a href= )? It is conventional wisdom that the PCRE functions are faster than their EREG cousins. However because/if you can guarantee that your

Re: [PHP] preg_replace() ??

2002-03-01 Thread Erik Price
On Thursday, February 28, 2002, at 10:33 PM, Monty wrote: Is preg_replace() the best PHP command to use for parsing custom codes in text retrieved from a database (e.g., turning [link= ] into a href= )? Use preg only if you need the power of regexes. If you are just looking to

Re: [PHP] preg_replace() ??

2002-03-01 Thread Erik Price
On Friday, March 1, 2002, at 10:34 AM, Erik Price wrote: On Thursday, February 28, 2002, at 10:33 PM, Monty wrote: Is preg_replace() the best PHP command to use for parsing custom codes in text retrieved from a database (e.g., turning [link= ] into a href= )? Use preg only if you

[PHP] preg_replace() ??

2002-02-28 Thread Monty
Is preg_replace() the best PHP command to use for parsing custom codes in text retrieved from a database (eg, turning [link= ] into a href= )? -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp

[PHP] preg_replace(/^\//.. doesnt work?

2002-02-20 Thread John Ericson
Im having a weird regexp problem in PHP that I think is correct but it doesnt appear to work. The code is this: $a = /test/; preg_replace(/^\//, , $a); echo $a; I want preg_replace to replace the first '/' in $a with '' so that the echo function echoes test/,

Re: [PHP] preg_replace(/^\//.. doesnt work?

2002-02-20 Thread James Taylor
try: $a = preg_replace(/^\//, , $a); On Wednesday 20 February 2002 12:25 pm, you wrote: Im having a weird regexp problem in PHP that I think is correct but it doesnt appear to work. The code is this: $a = /test/; preg_replace(/^\//, , $a); echo $a; I want

RE: [PHP] preg_replace(/^\//.. doesnt work?

2002-02-20 Thread Darren Gamble
Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: John Ericson [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 20, 2002 1:25 PM To: [EMAIL PROTECTED] Subject: [PHP] preg_replace(/^\//.. doesnt work? Im having

[PHP] preg_replace problem.

2002-02-17 Thread Paul Roberts
where am i going wrong i used $mail = preg_replace(/p[^]*?/i,\n\n$0, $mail,-1); and $mail = preg_replace(/p[^]*?/i,\n\n\\1, $mail,-1); but i get $0 or \1 inserted, but only on the linux server not on my win 2000 dev machine! Paul Roberts [EMAIL PROTECTED] -

[PHP] preg_replace()str_replace() escaping a double-quote problem

2002-02-01 Thread Anton Kolev
Any idea why when I print the value of $text, I get a backslash in front of the result. Any of the following: $text=preg_replace(/\/, quot;, $text); $text=preg_replace(/\/, A, $text); str_replace() also does the same :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

[PHP] preg_replace() 'space' the final frontier

2002-01-30 Thread hugh danaher
What I am trying to do is have a line of text break at a space after reading 19 words. Having read the various methods of finding and replacing one character with another, I settled on preg_replace as my best choice, but this function doesn't accept a space in the regular expression slot.

RE: [PHP] preg_replace() 'space' the final frontier

2002-01-30 Thread Matthew Walker
$statement=preg_replace(/ /,br,$original,19); Matthew Walker Ecommerce Project Manager Mountain Top Herbs -Original Message- From: hugh danaher [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 30, 2002 12:35 PM To: Php-General Subject: [PHP] preg_replace() 'space' the final

RE: [PHP] preg_replace() 'space' the final frontier

2002-01-30 Thread Matthew Walker
To: hugh danaher; Php-General Subject: RE: [PHP] preg_replace() 'space' the final frontier $statement=preg_replace(/ /,br,$original,19); Matthew Walker Ecommerce Project Manager Mountain Top Herbs -Original Message- From: hugh danaher [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 30

Re: [PHP] preg_replace() 'space' the final frontier

2002-01-30 Thread Jason Wong
On Thursday 31 January 2002 04:00, Matthew Walker wrote: What I am trying to do is have a line of text break at a space after reading 19 words. Having read the various methods of finding and replacing one character with another, I settled on preg_replace as my best choice, but this function

RE: [PHP] preg_replace help

2002-01-12 Thread Boaz Yahav
=get_example.php3?count=1403 Sincerely berber Visit http://www.weberdev.com Today!!! To see where PHP might take you tomorrow. -Original Message- From: Gaylen Fraley [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 12, 2002 5:20 AM To: [EMAIL PROTECTED] Subject: [PHP] preg_replace help I

[PHP] preg_replace help

2002-01-11 Thread Gaylen Fraley
I have need to be able to replace text within a string to turn it into a link. In other words, I might have a phrase lik: blah, blah, blah, please visit my site at www.mysite.com. blah, blah,blah. I need to have the string converted to blah, blah, blah, please visit my site at

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,

[PHP] preg_replace

2001-10-05 Thread W. Kiecksee
Hello! I just want to replace a string with another, but I have problems, when the string contains a [ or something similar. I just need a method to replace [cool] with text. When I use: $mustbereplaced = [cool]; $message = preg_replace(/$mustbereplaced/, hello, $message); only cool will be

RE: [PHP] preg_replace

2001-10-05 Thread Jack Dempsey
: [PHP] preg_replace Hello! I just want to replace a string with another, but I have problems, when the string contains a [ or something similar. I just need a method to replace [cool] with text. When I use: $mustbereplaced = [cool]; $message = preg_replace(/$mustbereplaced/, hello, $message); only

Re: [PHP] preg_replace

2001-10-05 Thread Andrey Hristov
Escape the [] with \. $pattern='\[find\]'; echo preg_replace(/$pattern/,[find]); Andrey Hristov IcyGEN Corporation BALANCED SOLUTIONS http://www.icygen.com On Friday 05 October 2001 21:17, you wrote: Hello! I just want to replace a string with another, but I have problems, when the string

[PHP] preg_replace

2001-10-04 Thread Oliver Ruf
Hello I'm trying to write some kind of parser... see the example: $text = [LINK image.png]MyImage[/LINK]; $out = preg_replace (/\[LINK*\]*\[/LINK\]/i, /a href=\*\*/a/,$text); Well... What I would like is, that $out would be something like about this: a

Re: [PHP] preg_replace

2001-10-04 Thread Oliver Ruf
anything. - Original Message - From: Oliver Ruf [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 04, 2001 4:23 PM Subject: [PHP] preg_replace Hello I'm trying to write some kind of parser... see the example: $text = [LINK image.png]MyImage[/LINK

[PHP] preg_replace is modifying the type of replacement parameter !!

2001-09-11 Thread Nicolas Guilhot
Hi guys, When I use preg_replace with an array of integer as the replacement parameter, this function modifies the type of each array element to string. I don't understand why it alters the content of the array while this variable is not pass by reference (True or not ??). I have just upgraded

Re: [PHP] preg_replace is modifying the type of replacement parameter !!

2001-09-11 Thread Andrey Hristov
- Original Message - From: Nicolas Guilhot [EMAIL PROTECTED] To: Php General MailingList [EMAIL PROTECTED] Sent: Tuesday, September 11, 2001 3:24 PM Subject: [PHP] preg_replace is modifying the type of replacement parameter !! Hi guys, When I use preg_replace with an array of integer

RE: [PHP] preg_replace is modifying the type of replacement parameter !!

2001-09-11 Thread Nicolas Guilhot
] Objet : Re: [PHP] preg_replace is modifying the type of replacement parameter !! Hmmm, RegEx work on strings, so the engine needs strings. Because of that your integers are converted to strings, if you want to give their life back make foreach ($arr as $k=$v){ $arr[$k]+=0; } Now all

[PHP] preg_replace() substrings NOT IN tags

2001-07-31 Thread Bruce BrackBill
Hi, I'm trying to figure out a regex that would match substrings in a string that are NOT inside tags. In the example below I try to replace the substring 'paris' with a href=\http://www.somehost.com;paris/a but it also matches 'paris' in the image name. * this does not work: $url =

[PHP] preg_replace on array with E (PCRE_DOLLAR_ENDONLY) modifier

2001-04-23 Thread Grant Walters
Hi, I'm having problems stopping preg_replace from losing $ signs and following text when replacing with array variables. I am trying to use the E modifier and keep getting: Warning: Unknown modifier 'E' in script.WEB.php3 on line 413 $template=array( /({PAGETOP})/E, /({PAGEMIDDLE})/E,

Re: [PHP] preg_replace on array with E (PCRE_DOLLAR_ENDONLY) modifier

2001-04-23 Thread Plutarck
Try switing the modifier to e. E is not a supported modifier according to the manual. Only the following are supported: i m s x e A D S U X If you are trying to match a $ in your code, just use a backspace to escape it. But I don't think that was your problem... -- Plutarck Should be working

Re: [PHP] preg_replace on array with E (PCRE_DOLLAR_ENDONLY) modifier

2001-04-23 Thread CC Zona
In article 9c2j66$1nt$[EMAIL PROTECTED], [EMAIL PROTECTED] (Plutarck) wrote: If you are trying to match a $ in your code, just use a backspace to escape it. Or enclose it in square braces. [$] Or use preg_quote(). -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

Re: [PHP] preg_replace pain!

2001-01-18 Thread Christian Reiniger
On Thursday 18 January 2001 07:40, Nicholas Pappas wrote: I was hoping someone could help me with this regular expression... $pattern = "/\[b\](.*)\[\/b\]/Ui"; $message = preg_replace($pattern, "B\\1/B", $message); The above works for: [b]bold text[/b]

[PHP] preg_replace problem

2001-01-18 Thread The Captain
I have a regular expression that's not giving me the results i really need. I have a bunch of strings coming at me that need to be truncated if they're over 15 characters... but not to truncate until after it reaches the first word. This regular expression just doesn't seem to want to work

Re: [PHP] preg_replace pain!

2001-01-18 Thread Shaun Thomas
On Thu, 18 Jan 2001, Christian Reiniger wrote: On Thursday 18 January 2001 07:40, Nicholas Pappas wrote: I was hoping someone could help me with this regular expression... $pattern = "/\[b\](.*)\[\/b\]/Ui"; $message = preg_replace($pattern, "B\\1/B", $message); The

[PHP] preg_replace pain!

2001-01-17 Thread Nicholas Pappas
I was hoping someone could help me with this regular expression... $pattern = "/\[b\](.*)\[\/b\]/Ui"; $message = preg_replace($pattern, "B\\1/B", $message); The above works for: [b]bold text[/b] But does not work for: [b]bold text

RE: [PHP] preg_replace pain!

2001-01-17 Thread Maxim Maletsky
Original Message- From: Nicholas Pappas [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 18, 2001 3:41 PM To: [EMAIL PROTECTED] Subject: [PHP] preg_replace pain! I was hoping someone could help me with this regular expression... $pattern = "/\[b\](.*)\[\/b\]/U

<    1   2   3