RE: [PHP] preg_replace - understanding

2003-07-08 Thread Jennifer Goodie
$filevalue = str_replace(\\, /, $filevalue); it is reversing the \\ to // but not replacing them with just a single /. I think you need to escape your \ so each \ is \\ so your string should be -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] preg_replace - understanding

2003-07-08 Thread Micah Montoya
PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, July 08, 2003 5:43 PM Subject: RE: [PHP] preg_replace - understanding $filevalue = str_replace(\\, /, $filevalue); it is reversing the \\ to // but not replacing them with just a single /. I think you need to escape your \ so each \ is \\ so

Re: [PHP] preg_replace - understanding

2003-07-08 Thread Micah Montoya
Never mind. Its working. thanks - Original Message - From: Jennifer Goodie [EMAIL PROTECTED] To: Micah Montoy [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, July 08, 2003 5:43 PM Subject: RE: [PHP] preg_replace - understanding $filevalue = str_replace(\\, /, $filevalue

Re: [PHP] preg_replace problem

2003-06-24 Thread Wendell Brown
On Tue, 17 Jun 2003 07:25:00 -0400, Vincent Bouret wrote: I want A dog jumped over a ladder to become xyzA/xyz dog jumped over xyza/xyz ladder. How about this... $str = A dog jumped over a ladder; $str = preg_replace( /(^| )(a)( |$)/i, $1xyz$2/xyz$3, str ); -- PHP General Mailing List

Re: [PHP] preg_replace problem

2003-06-17 Thread Marek Kilimajer
You need \b = word boundary. $string=preg_replace(/\\b($word)\\b/i,'xyz\1/xyz', $string); Vincent Bouret wrote: Hi, I am having this problem with preg_replace. I want the following thing but I can't understand what regular expression I should put. I want to replace all occurences of a given

Re: [PHP] preg_replace problem

2003-06-17 Thread Stefan Dengscherz
Hello, ?php $parsed = preg_replace(/(\ba\b)/i,tag\\1/tag,$sourcestring); ? should do the job. regards Am Die, 2003-06-17 um 13.25 schrieb Vincent Bouret: Hi, I am having this problem with preg_replace. I want the following thing but I can't understand what regular expression I

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 question,

2003-03-14 Thread John W. Holmes
the current function been put in place replaces [f1253f] with a file, for inside cms content , where 1253 is the key or the id of the filename in the database , therefore to denote its an ftool they added f's around the keys , so maybe i could get away with [1253], what else i'm asking if

RE: [PHP] preg_replace question,

2003-03-13 Thread John W. Holmes
yes another one sorry, i'm trying to find the most efficient way to do a replactment over this eregi_replace(\[f$key\f\],$value,format_content($content));, would preg_replace be quicker and how could i go about it ? i'd need to replace [f1247f] with its replacement value better still maybe

RE: [PHP] preg_replace question,

2003-03-13 Thread daniel
the current function been put in place replaces [f1253f] with a file, for inside cms content , where 1253 is the key or the id of the filename in the database , therefore to denote its an ftool they added f's around the keys , so maybe i could get away with [1253], what else i'm asking if

RE: [PHP] preg_replace with /e modifier

2003-02-24 Thread John W. Holmes
You can't have a special character as the key to an array without surrounding it by quotes. Here's a solution to that and a better way to organize your code. If you define your array as such: $color=array( //numeric 1=#FF,2=#00FF00,3=#F0FF0F, 4=#FF,5=#00,6=#FF00FF,

RE: [PHP] preg_replace

2003-02-18 Thread John W. Holmes
This should work (as far as I can tell) But yields the following error. Parse error: parse error, unexpected T_CHARACTER, expecting T_STRING or T_VARIABLE or T_NUM_STRING Any help is appreciated! function HTMLfromNickName ( $player ) { //example input ^2pla^3yer $color=array(

Re: [PHP] preg_replace question

2002-12-23 Thread Jason Wong
On Monday 23 December 2002 18:34, electroteque wrote: yet another regex question how could i hange the value within the quotes with preg_replace php_value upload_max_filesize 5M If php_value upload_max_filesize is fixed then there is no need to use preg_replace. Just use a simple

RE: [PHP] preg_replace works on normal string but not with a string build from a file

2002-12-03 Thread John W. Holmes
take a look at the following code basic problem is, it works with the custom build string in the script but not if get the code from a file. I allways used ereg_replace but after installing a newer version of php (4.2.2) it became very slow, so now I'm trying preg_replace please help !!!

Re: [PHP] preg_replace works on normal string but not with a string build from a file

2002-12-03 Thread Jeroen Olthof
Thx, I had created a workarround, withs was looping through every line of the file and doing a rtrim. But your hint pointed me to the better solution The modifier m alone didn't do the job, because I uses a dot to match any character. But without the s modifier it will not match a new line. So

RE: [PHP] preg_replace wierdness

2002-11-22 Thread John W. Holmes
Code snippet - ?php header('Content-type: text/plain'); $foo = 'img src=images/php.png img src=images/apache.png'; echo $foo\n; $path = '../../../'; $bar = preg_replace('/(img src=)(.*)/', $1 . $path . $2, $foo); echo $bar; It's being greedy. Your pattern is matching (img

Re: [PHP] Preg_replace question

2002-11-21 Thread Marek Kilimajer
Try xml parsing functions, start with an empty string and build it up in your handlers. In start element handler check if the tag is allowed, if yes, append it to the string together with allowed attributes, and add it to a count (so users won't be able to mess up your design), else append it

Re: [PHP] Preg_replace question

2002-11-21 Thread 1LT John W. Holmes
Following on from a previous discussion, I am trying to write a safe strip_tags function. I start by applying htmlentities to the entire string, and then convert allowed tags back. One of the steps I am looking at doing is to replace something lt;a href=blah onmouseover=blahgt; with a

Re: [PHP] Preg_replace question

2002-11-21 Thread Ernest E Vogelsinger
At 15:38 21.11.2002, David Russell spoke out and said: [snip] One of the steps I am looking at doing is to replace something lt;a href=blah onmouseover=blahgt; with a href=blah [snip] I found it way easier not to

Re: [PHP] Preg_replace question

2002-11-21 Thread Justin French
I've been down the road of attempting to do this with regular expressions... i'm no expert, but i work with people who are, and it was a nightmare given that the following are common/valid href=something.php href = 'something.php' href='something.php' href = something.php href=something.php

Re: [PHP] preg_replace question

2002-11-20 Thread Chris Shiflett
--- electroteque [EMAIL PROTECTED] wrote: how could i remove http://www. ot of a url string using preg_replace? No need to reinvent the wheel for this. Just use parse_url() instead: http://www.php.net/manual/en/function.parse-url.php Chris -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] preg_replace question

2002-11-20 Thread 1LT John W. Holmes
--- electroteque [EMAIL PROTECTED] wrote: how could i remove http://www. ot of a url string using preg_replace? No need to reinvent the wheel for this. Just use parse_url() instead: http://www.php.net/manual/en/function.parse-url.php Or just str_replace(). No need for regular

RE: [PHP] preg_replace question

2002-11-20 Thread Dan Rossi
looks like it returns www in the host array a bit silly when i need just the bits afterwards to do a gethostbyname -Original Message- From: Chris Shiflett [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 21, 2002 7:41 AM To: electroteque; [EMAIL PROTECTED] Subject: Re: [PHP

RE: [PHP] preg_replace question

2002-11-20 Thread Dan Rossi
this is fine but it didnt parse in just www.domain.com -Original Message- From: Chris Shiflett [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 21, 2002 7:41 AM To: electroteque; [EMAIL PROTECTED] Subject: Re: [PHP] preg_replace question --- electroteque [EMAIL PROTECTED] wrote: how

RE: [PHP] preg_replace question

2002-11-20 Thread Dan Rossi
W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 21, 2002 7:48 AM To: [EMAIL PROTECTED]; electroteque; [EMAIL PROTECTED] Subject: Re: [PHP] preg_replace question --- electroteque [EMAIL PROTECTED] wrote: how could i remove http://www. ot of a url string using preg_replace

RE: [PHP] preg_replace question

2002-11-20 Thread Chris Shiflett
--- Dan Rossi [EMAIL PROTECTED] wrote: some urls will have http://www. some will only have www. some will have :1023 for forced ports and they all will have /directory afterwards i just need domain.com for example :| Out of curiosity, did you not read the replies to your initial question? I

Re: [PHP] preg_replace and eval

2002-10-28 Thread Maxim Maletsky
try splitting it first to get several strings into one array, then loop the array and replace its each element concatenating the strings. This is how my mind can process it so far :) -- Maxim Maletsky [EMAIL PROTECTED] www.PHPBeginner.com // PHP for Beginners www.maxim.cx // my Home

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); not

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

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

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

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
Good day, The first argument should just be a normal regular expression, not a replacement regular expression. I'm not at my server right now, but I would guess that it'll work once you get rid of the last / in the first expression. Darren Gamble Planner, Regional

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
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,

RE: [PHP] preg_replace

2001-10-05 Thread Jack Dempsey
http://php.net/str_replace if you're just replacing a static string, this will be faster and easier...only use regex's when you really need them jack -Original Message- From: W. Kiecksee [mailto:[EMAIL PROTECTED]] Sent: Friday, October 05, 2001 2:17 PM To: [EMAIL PROTECTED] Subject:

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

Re: [PHP] preg_replace

2001-10-04 Thread Oliver Ruf
It worked !! Thank you very much for your help! - Yours, Oliver [EMAIL PROTECTED] (Papp Gyozo) wrote in news:003701c14cf0$d7363300$01fdfea9@jaguar: $text = [LINK image.png]MyImage[/LINK]; $out = preg_replace (|\[LINK(.*)\](.*)\[/LINK\]|iU, 'a href=\1\2/a',$text); I hope, I don't forget

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

2001-09-11 Thread Andrey Hristov
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 are integers. Andrey Hristov IcyGEN Corporation http://www.icygen.com BALANCED SOLUTIONS

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

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]

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

RE: [PHP] preg_replace pain!

2001-01-17 Thread Maxim Maletsky
maybe : $pattern = "/\[b\]([.\n]*)\[\/b\]/Ui";. have you tried it succesfully? P.S: I am not sure that \n in preg is a newline, you could also try this: $pattern = "/\[b\]([.".chr(10).chr(13)."]*)\[\/b\]/Ui";. one of these ... Cheers, Maxim Maletsky -Original Message-

<    1   2