|
Posted by Andy Jeffries on 12/18/48 11:48
On Tue, 23 May 2006 06:11:02 -0500, Alan Little wrote:
>>>> "In limited-metacharacter-class implementations, other metacharacter
>>>> (including in most tools, even backslashes) are not recognized. So,
>>>> for example, you can't use \- or \] to insert a hyphen or a closing
>>>> bracket in to the class." This precedes a list of characters that are
>>>> available in these limited implementations which are specifically: a
>>>> leading caret, the closing bracket and a dash as a range operator.
>
> Pardon my density, but I still don't follow you. The book says:
>
>>>> "So, for example, you can't use \- or \] to insert a hyphen or a
>>>> closing bracket in to the class."
>
> You say:
>
>>>> I am correct to use [^0-9\-] in order to ensure
>
> The book says it's incorrect, but you're saying it's correct? Am I missing
> something?
The book is saying in (limited, non-full, implementations) you cannot use
"\-" to insert a hyphen as you cannot search for a hyphen as one of the
characters in a metaclass.
It gives an example (which I paraphrased) of the only acceptable
characters in a limited implementation and basically you can't include (in
any shape or form) hyphens or square brackets in the class.
So the book said "in these limited forms you can't use \- to insert a
hyphen", which by the phrasing indicates that's the normal way of doing it
in a full implementation.
PHP is a full PCRE implementation with all bells and whistles (including
backreferences).
Does that make more sense?
Cheers,
Andy
--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos
Navigation:
[Reply to this message]
|