2012/7/17 Ángel González <keis...@gmail.com>:
> Those could be in the flag. The / are not really needed, they are an
> additional syntax over regex provided by PHP (and the character can be a 
> different

makes it a little bit like Perl. I see this as a "standard". So for me
a regex is with delimiters, even if the lib doesn't need them.

> one, although usually / is picked).

Think, it comes from SED. I usaly use '#' - better visibility. :)


> The above code doesn't support POSIX character classes, just picking
> characters out of a string (which I agree is simple).

PCRE uses the Posix classes...

[btw. off topic: I read thrugh http://www.pcre.org/pcre.txt - meiomei,
they have introduced things here... "backtracking control", "path
recording"... incredible]


>> // Search spacer strings
>> strpbrk ("Hello World", str_charset('/[\s]/'));
> So you're expanding all spacing characters, then iterating over them
> with strpbrk(),
> a preg_match() would have been more efficient.

Of course. Every example could be done more efficient with regex. It's
not the point! Once used, str_charset() is "ready", the result can be
cached and reused for much more things. And then it's faster than
pcre, even ready compiled.

Hm.


Maybe back to the roots? Using range() is not so complicated:

implode('',
     array_merge(
             range('a','z'),
             range('A','Z'),
             range('0','9'))
     ))

<shrug> So I think, if we don't need charset-encoding, we won't need
this special functionality.

-- 
Alex Aulbach

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to