I know that lookahead pattern is not allowed in XSLT with saxon, but I need to know how I can use this regular expression in XSLT 2.0:
<xsl:if test='matches($value,"^(?!\s*$).{x,y}$")'>
where x and y are numbers. Any suggestions please?
I know that lookahead pattern is not allowed in XSLT with saxon, but I need to know how I can use this regular expression in XSLT 2.0:
<xsl:if test='matches($value,"^(?!\s*$).{x,y}$")'>
where x and y are numbers. Any suggestions please?
According to https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html the Java language supports e.g. (?!X)
as X, via zero-width negative lookahead
so you should be able to enable it with Saxon using the flag ;j'
, as in matches(string, '(?!subpattern1)subpattern2', ';j')
as Saxon allows you (http://saxonica.com/html/documentation/functions/fn/matches.html) to switch to the Java regular expression language using that flag.