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
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
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
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
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 =
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
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
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
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
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
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 =
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.
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
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
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
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
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,
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
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
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
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
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/,
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
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
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]
-
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,
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.
$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
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
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
=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
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
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
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,
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
: [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
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
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
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
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
- 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
]
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
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 =
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,
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
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,
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]
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
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
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
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
201 - 251 of 251 matches
Mail list logo