RE: [PHP] Regex not working with :

2009-04-22 Thread kyle.smith
Have you tried escaping the : with a \?

Like:
mb_ereg_replace('^(.*)this is the test\: replace(.*)$', '', $contents
,'UTF-8');

Also, have you tried removing the : and adjusting the input string to
verify your belief that it's the :?

HTH,
Kyle

-Original Message-
From: Merlin Morgenstern [mailto:merli...@fastmail.fm] 
Sent: Wednesday, April 22, 2009 4:09 AM
To: php-general@lists.php.net
Subject: [PHP] Regex not working with :

Hi there,

I am trying to remove a text which does contain a : inside. Somehow the
regex does not match, no matter what I do:

$contents = mb_ereg_replace('^(.*)this is the test: replace(.*)$', '',
$contents ,'UTF-8');

Looks like this is a result of the :.

Does anybody have an idea how to do this?

Thank you for any help.

Merlin

--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Regex not working with :

2009-04-22 Thread Richard Quadling
2009/4/22 kyle.smith kyle.sm...@inforonics.com:
 Have you tried escaping the : with a \?

 Like:
 mb_ereg_replace('^(.*)this is the test\: replace(.*)$', '', $contents
 ,'UTF-8');

 Also, have you tried removing the : and adjusting the input string to
 verify your belief that it's the :?

 HTH,
 Kyle

 -Original Message-
 From: Merlin Morgenstern [mailto:merli...@fastmail.fm]
 Sent: Wednesday, April 22, 2009 4:09 AM
 To: php-general@lists.php.net
 Subject: [PHP] Regex not working with :

 Hi there,

 I am trying to remove a text which does contain a : inside. Somehow the
 regex does not match, no matter what I do:

 $contents = mb_ereg_replace('^(.*)this is the test: replace(.*)$', '',
 $contents ,'UTF-8');

 Looks like this is a result of the :.

 Does anybody have an idea how to do this?

 Thank you for any help.

 Merlin

 --
 PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
 http://www.php.net/unsub.php


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



Can you try ..

# Your regular expression could not be converted to the flavor
required by this language:
# A POSIX Extended RE cannot match the start and the end of a line with ^ and $
# A POSIX Extended RE cannot match the start and the end of a line with ^ and $

# Because of this, the code snippet below will not work as you
intended, if at all.

$contents = mb_ereg_replace('^(.*)this is the test: replace(.*)$',
'\1\2', $contents, 'UTF-8');



The warnings above come from RegexBuddy. Considering the PHP examples,
I'm not sure how accurate they are.
-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Regex not working with :

2009-04-22 Thread Merlin Morgenstern



Richard Quadling wrote:

2009/4/22 kyle.smith kyle.sm...@inforonics.com:

Have you tried escaping the : with a \?

Like:
mb_ereg_replace('^(.*)this is the test\: replace(.*)$', '', $contents
,'UTF-8');

Also, have you tried removing the : and adjusting the input string to
verify your belief that it's the :?

HTH,
Kyle

-Original Message-
From: Merlin Morgenstern [mailto:merli...@fastmail.fm]
Sent: Wednesday, April 22, 2009 4:09 AM
To: php-general@lists.php.net
Subject: [PHP] Regex not working with :

Hi there,

I am trying to remove a text which does contain a : inside. Somehow the
regex does not match, no matter what I do:

$contents = mb_ereg_replace('^(.*)this is the test: replace(.*)$', '',
$contents ,'UTF-8');

Looks like this is a result of the :.

Does anybody have an idea how to do this?

Thank you for any help.

Merlin

--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Can you try ..

# Your regular expression could not be converted to the flavor
required by this language:
# A POSIX Extended RE cannot match the start and the end of a line with ^ and $
# A POSIX Extended RE cannot match the start and the end of a line with ^ and $

# Because of this, the code snippet below will not work as you
intended, if at all.

$contents = mb_ereg_replace('^(.*)this is the test: replace(.*)$',
'\1\2', $contents, 'UTF-8');



The warnings above come from RegexBuddy. Considering the PHP examples,
I'm not sure how accurate they are.

Hi there,

thank you for the help. Actually it was due to case sensitivity. Use 
str_ireplace to fix it.


Regards, Merlin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] (Regex) not working, take a quick look at it plz?

2004-10-30 Thread Jason Wong
On Friday 29 October 2004 23:12, Ryan A wrote:

 I totally suck at RegEx (but am trying to learn), I got the following from
 the web, but its not working for me...
 can anyone spot what I am doing wrong or whats wrong please?

And what *exactly* is wrong?

What did you expect the code to do?

What did the code actually do?

Did you try debuggiong it yourself? print_r() or var_dump() everything.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Rome wasn't burnt in a day.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php