Re: [xsl] check the type of the $pattern argument to a regular expression?

Subject: Re: [xsl] check the type of the $pattern argument to a regular expression?
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Mon, 16 Apr 2007 15:11:24 +0200
bryan rasmussen wrote:
Is there a concise description somewhere as to how they differ, are
there a large number of xslt regular expressions that are compatible
with Java regular expressions or are they basically incompatible? I
would suppose the main difference is that XSL-T regular expressions
are Unicode compatible regex's  - correct?


I don't suppose there is such an overview. Some flavors are explained in Jeffrey Friedl's famous book and some are (briefly) explained here: http://regular-expressions.info. But they don't explain W3's favorite flavor (which is to a large part one-way compatible with Perl's flavor). You could check and compare the following:


XSLT / XPath regexes: http://www.w3.org/TR/xmlschema-2/#regexs and http://www.w3.org/TR/xpath-functions/#regex-syntax
Java regexes: http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html


The most obvious differences in syntax I found are the Java specific constructs, which are not covered in W3's flavor, like \p{javaLower} etc., possessive quantifiers, Quotation (\Q - \E), end/start of text (\A and \Z) and all special constructs (there is no look-ahead/look-behind, non-capturing parentheses, flags on/of in a group etc).

Cheers,
-- Abel Braaksma

Current Thread