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
$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'],
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
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
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++;
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
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
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
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
> 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
> 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
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
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
>
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,
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
; atur
>
>
>
>
>
>
> - Original Message -
> From: "Jim Lucas" <[EMAIL PROTECTED]>
> To: "Armand Turpel" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Saturday, September 20, 2003 5:37 PM
> Subjec
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/",
>
$arr = array("/([^\<][^\/][^h][^1-6].{1}[^\>])\r\n/",
"/([^\<][^\/][^h][^1-6].{1}[^\>])\r/",
"/([^\<][^\/][^h][^1-6].{1}[^\>])\n/",
);
$text = preg_replace($arr,"\\1",$text);
you might try this and see how well it works.
Jim Lucas
- Original Message -
[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
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
> 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
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
> 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
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
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
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
> 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">
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
> 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]+)%
--- 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 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
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]>
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
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
> --- 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
--- 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/)
36 matches
Mail list logo