Bug #4913

Documentation/code discrepancy in regex flag for using the JavaScript RE engine

Added by Norm Tovey-Walsh 3 months ago. Updated 4 days ago.

Start date:
Due date:
% Done:


Estimated time:
Applies to JS Branch:
Fix Committed on JS Branch:
Fixed in JS Release:
SEF Generated with:
Contact person:
Additional contact persons:


In, Martin Honnen writes:

In!conformance/regex I find the statement:

Saxon-JS allows the flags argument to be suffixed with the string ";j". If this option is present then the JavaScript regular expression engine is used directly, which means that the JavaScript rules rather than the XPath rules apply

However I get an error trying to use ;j as a flag. What seems to not raise an error is simply the suffix j as in e.g. analyze-string(., '\bcan\b', 'ij')/fn:match => count().

Is the documentation wrong or the implementation not doing what the documentation says?


#1 Updated by Norm Tovey-Walsh 16 days ago

  • Status changed from New to Resolved

It's a documentation bug. The "j" flag is correct. I've updated the documenation for the next release. Thank you!

#2 Updated by Martin Honnen 16 days ago

Thanks for the clarification.

However, that resolution deviates from the way Saxon Java or .NET handle Saxon specific flags ( as they have to be appended by after a semicolon.

So in term of interoperability it would make more sense to me if Saxon-JS also allowed to append the Saxon specific flag(s) after a semicolon.

#3 Updated by Norm Tovey-Walsh 15 days ago

In practice, there are no mutually compatible flags, though I suppose "j" for Java and "j" for JavaScript might have usefully overlapping semantics.

However, I take your point about compatibility. Unfortunately, we now have a backwards incompatibility in both directions since requiring the semicolon would be incompatible with current Saxon-JS releases.

I've updated the code to optionally support the ";" syntax compatible with other Saxon products and updated the documentation to indicate that that is the preferred syntax. The current syntax, without the ";", will continue to work at least for 'j'.

#4 Updated by Norm Tovey-Walsh 4 days ago

  • Status changed from Resolved to Closed

This issue has been resolved in the Saxon 2.2 maintenance release.

#5 Updated by Norm Tovey-Walsh 4 days ago

This issue has been resolved in the Saxon 2.2 maintenance release.

#6 Updated by Debbie Lockett 4 days ago

  • % Done changed from 0 to 100
  • Fixed in JS Release set to Saxon-JS 2.2
  • Fix Committed on JS Branch 2 added

#7 Updated by Debbie Lockett 4 days ago

  • Applies to JS Branch 2 added

Please register to edit this issue

Also available in: Atom PDF Tracking page