Re: special char at pos 0 problem
Brought to you by:
bs_php,
nigelswinson
From: Nigel S. <nig...@us...> - 2002-05-21 22:04:37
|
> On Friday 17 May 2002 9:03, J. Carmanns wrote: > > Found a simple solution: > > > > Add these special chars to preg_match expression on line 2672: > > > > Old: > > elseif (preg_match('/^[a-zA-Z0-9\-_]+/', $nodeTest)) { > > > > New: > > elseif (preg_match('/^[a-zA-Z0-9\-_ÄÖÜäöü]+/', $nodeTest)) { > > > > Maybe there are more chars to add? > > Looks more like a quick fix than a solution - why only German accents and not > French or anything else?! > > raises the question in my mind: why is this limitation on node names in there > anyway? Surely there is no such limitation in the xml spec? There is no such limitation. In that line we are purely trying to work out if the $nodeTest is JUST a node name, or whether it is an XPath Expression. My suggestion is that we change to: elseif (preg_match('/^[\w\-]+$/', $nodeTest)) { The PHP manual says \w is a word character where a word character is defined as: ============= A "word" character is any letter or digit or the underscore character, that is, any character which can be part of a Perl "word". The definition of letters and digits is controlled by PCRE's character tables, and may vary if locale-specific matching is taking place (see "Locale support" above). For example, in the "fr" (French) locale, some char- acter codes greater than 128 are used for accented letters, and these are matched by \w. ============= Cheers, Nigel |