Re: [PHP] preg_replace question

2012-12-12 Thread Simon J Welsh
On 13/12/2012, at 10:08 AM, Curtis Maurand wrote: > On 12/12/2012 3:47 PM, Maciek Sokolewicz wrote: >> On 12-12-2012 21:10, Curtis Maurand wrote: >>> On 12/12/2012 12:00 PM, Maciek Sokolewicz wrote: On 12-12-2012 17:11, Curtis Maurand wrote: First of all, why do you want to use pre

[PHP] preg_replace question

2012-12-12 Thread Curtis Maurand
I have several poisoned .js files on a server. I can use find to recursively find them and then use preg_replace to replace the string. However the string is filled with single quotes, semi-colons and a lot of other special characters. Will preg_relace(escapeshellarg($String),$replacement) w

Re: [PHP] preg_replace question

2011-01-25 Thread Alex Nikitin
$internal_links=array(); I prefer to init arrays, it also avoids unnecessary notices, and sometimes weird results, but either one of those while loops should make the desired array while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { array_push($internal_links, array('phrase'=>$row['phrase'],

Re: [PHP] preg_replace question

2011-01-25 Thread Richard Quadling
On 25 January 2011 12:04, Merlin Morgenstern wrote: > Am 25.01.2011 12:31, schrieb Merlin Morgenstern: >> >> Am 24.01.2011 18:08, schrieb Alex Nikitin: >>> >>> If you declare your arrays, and set k to 0 first, put quotes around array >>> values and use the correct limit (you can default to -1), yo

Re: [PHP] preg_replace question

2011-01-25 Thread Merlin Morgenstern
Am 25.01.2011 12:31, schrieb Merlin Morgenstern: Am 24.01.2011 18:08, schrieb Alex Nikitin: If you declare your arrays, and set k to 0 first, put quotes around array values and use the correct limit (you can default to -1), you will get results, here is code and example (hopefully this helps you

Re: [PHP] preg_replace question

2011-01-25 Thread Merlin Morgenstern
Am 24.01.2011 18:08, schrieb Alex Nikitin: If you declare your arrays, and set k to 0 first, put quotes around array values and use the correct limit (you can default to -1), you will get results, here is code and example (hopefully this helps you) \\1'; $k++;

Re: [PHP] preg_replace question

2011-01-24 Thread Jim Lucas
On 1/24/2011 8:00 AM, Merlin Morgenstern wrote: > Hi there, > > I am trying to replace certain words inside a text with php. Unfortunatelly my > function is creating invalid html as output. > > For example the words "beagle" and "welpen" have to be replaced inside this > text: "süße knuffige Beag

Re: [PHP] preg_replace question

2011-01-24 Thread Alex Nikitin
If you declare your arrays, and set k to 0 first, put quotes around array values and use the correct limit (you can default to -1), you will get results, here is code and example (hopefully this helps you) \\1'; $k++; } return preg_replace($pat

Re: [PHP] preg_replace question

2011-01-24 Thread David Harkness
Without seeing the code that creates the arrays, it's tough to see the problem. It looks like the first replacement is catching "Beagle Welpen" entirely since the closing tag gets placed after "Welpen". Then the second replacement does just "Welpen". Also, you should have quotes around "link" whe

[PHP] preg_replace question

2011-01-24 Thread Merlin Morgenstern
Hi there, I am trying to replace certain words inside a text with php. Unfortunatelly my function is creating invalid html as output. For example the words "beagle" and "welpen" have to be replaced inside this text: "süße knuffige Beagle Welpen ab sofort" My result looks like this: zwei süß

Re: [PHP] preg_replace() question

2009-03-18 Thread Robert Cummings
On Wed, 2009-03-18 at 22:55 +0800, Virgilio Quilario wrote: > > 1. What is the overhead on preg_replace? > > it really depends on your operation. when you think it can be done > using str* functions then go for it as they are much faster than preg* > functions. > > > 2. Is there a better way to s

Re: [PHP] preg_replace() question

2009-03-18 Thread Virgilio Quilario
> 1. What is the overhead on preg_replace? it really depends on your operation. when you think it can be done using str* functions then go for it as they are much faster than preg* functions. > 2. Is there a better way to strip spaces and non alpha numerical > characters from text strings? I susp

Re: [PHP] preg_replace() question

2009-03-18 Thread Richard Heyes
> 1. What is the overhead on preg_replace? Minimal. If you're looking for all the speed you can get, you'd probably be better off with an str* function though if you can find one. You'd have to be seriously after speed gains though. > 2. Is there a better way to strip spaces and non alpha numeric

Re: [PHP] preg_replace() question

2009-03-17 Thread Chris
PJ wrote: 1. What is the overhead on preg_replace? Compared to what? If you write a 3 line regex, it's going to take some processing. 2. Is there a better way to strip spaces and non alpha numerical characters from text strings? I suspect not... maybe the Shadow does ??? For this, preg_re

[PHP] preg_replace() question

2009-03-17 Thread PJ
1. What is the overhead on preg_replace? 2. Is there a better way to strip spaces and non alpha numerical characters from text strings? I suspect not... maybe the Shadow does ??? :-D -- unheralded genius: "A clean desk is the sign of a dull mind. "

Re: [PHP] preg_replace Question

2008-04-04 Thread Per Jessen
Richard Luckhurst wrote: > e.g $amount = $524.00 however only 4.00 is displayed in the %Amount > field on the html page. I tried dropping the .00 from $amount to see > if this might be a length issue and then %Amount was just 4 > Am I doing something obviously wrong here? I have checked the php >

[PHP] preg_replace Question

2008-04-03 Thread Richard Luckhurst
Hi List I am trying to perform a number of replacements of place holders in an html page I am working on using preg_replace. I am stuck with a pronlem I can not work out and would appreciate some help. The code I have is as follows $html = preg_replace('/%Amount/',$amount,$html); $html

Re: [PHP] preg_replace question

2004-09-13 Thread Burhan Khalid
Zoran Lorkovic wrote: Btw, where I can find patterns that are valid? (something like (\w+), (\d+)+i etc. http://www.php.net/manual/en/reference.pcre.pattern.syntax.php http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

Re: [PHP] preg_replace question

2004-09-09 Thread John Holmes
Zoran Lorkovic wrote: Sorry for issuing this again, but I need help with preg_replace. I manage to replace certain text between in text with preg_replace but I want for every other to be replaced by other text. By this I mean when some text between has been found that text is replaced with som

[PHP] preg_replace question

2004-09-09 Thread Zoran Lorkovic
Hi Sorry for issuing this again, but I need help with preg_replace. I manage to replace certain text between in text with preg_replace but I want for every other to be replaced by other text. By this I mean when some text between has been found that text is replaced with some Text, on second

Re: [PHP] preg_replace question

2003-09-20 Thread Armand Turpel
; atur > > > > > > > - Original Message - > From: "Jim Lucas" <[EMAIL PROTECTED]> > To: "Armand Turpel" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Saturday, September 20, 2003 5:37 PM > Subjec

Re: [PHP] preg_replace question

2003-09-20 Thread Armand Turpel
urpel" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Saturday, September 20, 2003 5:37 PM Subject: Re: [PHP] preg_replace question > $arr = array("/([^\<][^\/][^h][^1-6].{1}[^\>])\r\n/", > "/([^\<][^\/][^h][^1-6].{1}[^\>])\r/", >

Re: [PHP] preg_replace question

2003-09-20 Thread Jim Lucas
see how well it works. Jim Lucas - Original Message - From: "Armand Turpel" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, September 20, 2003 8:21 AM Subject: [PHP] preg_replace question > I need the following replace function: > Replace all lin

[PHP] preg_replace question

2003-09-20 Thread Armand Turpel
I need the following replace function: Replace all line breaks to but not if a line break comes after an or or Currently I use this preg_replace but it's not good enough for all situations. $text = preg_replace("/([^\<][^\/][^h][^1-9].{1})\r\n/","\\1",$text); Thanks -- PHP Ge

Re: [PHP] preg_replace question

2003-08-17 Thread Jean-Christian IMbeault
[EMAIL PROTECTED] wrote: > Then use a simple strstr to first find out if the string does contain > mydomain.com :-) My example was a simple one. I can't just check to see if the string contains the mydomain.com first because I am not passing a string to preg_replace but a whole text file. I want

Re: [PHP] preg_replace question

2003-08-16 Thread [EMAIL PROTECTED]
Then use a simple strstr to first find out if the string does contain mydomain.com :-) Jean-Christian IMbeault wrote: I found this nice preg_replace function that replaces all occurrences of an HTML anchor ( preg_replace( "# I'd like to modify this expression so that it does the same thing b

[PHP] preg_replace question

2003-08-16 Thread Jean-Christian IMbeault
I found this nice preg_replace function that replaces all occurrences of an HTML anchor ( preg_replace( "# I'd like to modify this expression so that it does the same thing but *only* if the link is not to a specific page. I.e. I would like to replace all links *unless* the link was to, for e

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

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 preg_r

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 sti

[PHP] preg_replace question,

2003-03-13 Thread daniel
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

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 sub

[PHP] preg_replace question

2002-12-23 Thread electroteque
yet another regex question how could i hange the value within the quotes with preg_replace php_value upload_max_filesize "5M" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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.ph

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 "href="blah" onmouseover="blah">" with "" [snip] I found it way easier not to look for

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 " href="blah" onmouseover="blah">

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 u

[PHP] Preg_replace question

2002-11-21 Thread David Russell
Hi all, 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 "" wit

Re: [PHP] preg_replace question

2002-11-20 Thread 1LT John W. Holmes
> thats the thing the urls should be able to parse http:// or www or both and > i have to unfortunatly clean up a forced port and directory in the url > aswell for gethostname to work Well, your original question should of said that and we wouldn't be wasting time. preg_match("%\.([^.]+\.[a-z]+)%

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?

RE: [PHP] preg_replace question

2002-11-20 Thread Dan Rossi
i just need domain.com for example :| -Original Message- From: 1LT John 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]&g

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

RE: [PHP] preg_replace question

2002-11-20 Thread Dan Rossi
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? > > No need to reinvent the wheel for this. Just

RE: [PHP] preg_replace question

2002-11-20 Thread Dan Rossi
] preg_replace question --- 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 L

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 regula

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/)

[PHP] preg_replace question

2002-11-20 Thread electroteque
how could i remove http://www. ot of a url string sing preg_replace ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php