Re: Problems validating XML

On Tuesday 19 June 2007, olivier Thereaux wrote:
>
> /^<\?xml[\x20|\x9|\xD|\xA]+(version=("1.0"|"1.1"|'1.0'|'1.1')[\x20|
> \x9|\xD|\xA]+)?(encoding=("[A-Za-z][a-zA-Z0-9-_]+"|'[A-Za-z][a-zA-
> Z0-9-_]+')\x20|\x9|\xD|\xA]+)?(standalone=("yes"|"no"|'yes'|'no')
> [\x20|\x9|\xD|\xA]+)?[\x20|\x9|\xD|\xA]*\?>[\x20|\x9|\xD|\xA]*$/
>
> It should match XML declarations as defined by XML 1.0 and 1.1 specs,
> and not be too greedy.

A couple of questions about the regexp:  Does it work if there's a BOM?  
Doesn't it need the multiline modifier?

Received on Tuesday, 19 June 2007 18:03:29 UTC