On 13/12/2012, at 10:08 AM, Curtis Maurand cur...@maurand.com 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
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)
?php
function internal_links($str,
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
On 25 January 2011 12:04, Merlin Morgenstern merli...@fastmail.fm 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
$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'],
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 /a tag gets placed after Welpen. Then the
second replacement does just Welpen.
Also, you should have quotes around link when
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)
?php
function internal_links($str, $links, $limit=-1) {
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 Beagle Welpen
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
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
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 strip
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,
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
Zoran Lorkovic wrote:
Sorry for issuing this again, but I need help with preg_replace. I manage to replace certain text between
b/b in text with preg_replace but I want for every other b/b to be replaced by
other text.
By this I mean when some text between b/b has been found that text is
$arr = array(/([^\][^\/][^h][^1-6].{1}[^\])\r\n/,
/([^\][^\/][^h][^1-6].{1}[^\])\r/,
/([^\][^\/][^h][^1-6].{1}[^\])\n/,
);
$text = preg_replace($arr,\\1br /,$text);
you might try this and see how well it works.
Jim Lucas
- Original Message -
]; [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/,
/([^\][^\/][^h][^1-6].{1}[^\])\n/,
);
$text = preg_replace($arr
Subject: Re: [PHP] preg_replace question
Hi Jim ,
The problem with your proposition is that the preg_replace do not replace
/h1\r\n to /h1br /
thats good,
but also not this:
testh4\r\n
and thats not what I expect from.
atur
- Original Message -
From: Jim Lucas [EMAIL
[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 (a href=...) with a link to another PHP script that
log the link and then sends the
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
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
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
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
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
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
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
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
--- 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
--- 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
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
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
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
--- 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
34 matches
Mail list logo