On 14 March 2011 20:36, Hannes Landeholm landeh...@gmail.com wrote:
What is more likely to be wrong? Your understanding of a specific
regex pattern (which happens to be full of escapes making it
incredibly hard to read) or the implementation of preg_replace?
~Hannes
On 14 March 2011 16:18,
On 15 March 2011 10:32, Richard Quadling rquadl...@gmail.com wrote:
On 14 March 2011 20:36, Hannes Landeholm landeh...@gmail.com wrote:
What is more likely to be wrong? Your understanding of a specific
regex pattern (which happens to be full of escapes making it
incredibly hard to read) or the
static $re = '/(^|[^])\'/';
Did no one see why the regex was wrong?
I saw what the regex was. I didn't think like you that it was 'wrong'.
Once you unescape the characters in the PHP single-quoted string above
(where two backslashes count as one, and backslash-quote counts as a
Now, here is a pattern which actually means a quote which doesn't
already have a backslash before it which is achieved by means of a
lookbehind assertion, which, even when searching the string after the
first match, 'str, still 'looks back' on the earlier part of the
string to recognise the
On 03/15/11 12:41, Ben Schmidt wrote:
[snip]
Hope this helps,
Ben.
As an outsider in this discussion, I'd just like to applaud you for one
of the best, in-depth, most patient and most thorough explanations I
have ever seen on a mailing list.
Dave
--
PHP Internals - PHP Runtime
On 15 March 2011 12:41, Ben Schmidt mail_ben_schm...@yahoo.com.au wrote:
static $re = '/(^|[^])\'/';
Did no one see why the regex was wrong?
I saw what the regex was. I didn't think like you that it was 'wrong'.
Once you unescape the characters in the PHP single-quoted string above
I chose the simplest example to show the preg_replace behavior, there are
better (and safer) ways to scape slash characters.
Anyways, *is this the expected preg_replace behavior?*
Martin
?php
function test($str) {
static $re = '/(^|[^])\'/';
static $change = '$1\\\'';
echo
On 14 March 2011 15:18, Martin Scotta martinsco...@gmail.com wrote:
?php
function test($str) {
static $re = '/(^|[^])\'/';
static $change = '$1\\\'';
echo $str, PHP_EOL,
preg_replace($re, $change, $str), PHP_EOL, PHP_EOL;
}
test(str '' str); // bug?
test(str \\'\\'
On 15/03/11 2:18 AM, Martin Scotta wrote:
I chose the simplest example to show the preg_replace behavior,
You've GOT to be kidding. The SIMPLEST?!
How about an example that doesn't require escaping ALL the interesting
characters involved?
Here's a modified version that I think it quite a bit
On 15/03/11 5:38 AM, Ben Schmidt wrote:
On 15/03/11 2:18 AM, Martin Scotta wrote:
I chose the simplest example to show the preg_replace behavior,
You've GOT to be kidding. The SIMPLEST?!
How about an example that doesn't require escaping ALL the interesting
characters involved?
Here's a
What is more likely to be wrong? Your understanding of a specific
regex pattern (which happens to be full of escapes making it
incredibly hard to read) or the implementation of preg_replace?
~Hannes
On 14 March 2011 16:18, Martin Scotta martinsco...@gmail.com wrote:
I chose the simplest
11 matches
Mail list logo