Project

Profile

Help

Bug #4913

closed

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

Added by Norm Tovey-Walsh almost 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2021-02-18
Due date:
% Done:

100%

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

Description

In https://saxonica.plan.io/boards/5/topics/8129?pn=1, Martin Honnen writes:

In https://www.saxonica.com/saxon-js/documentation/index.html#!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?

Actions #1

Updated by Norm Tovey-Walsh over 3 years 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!

Actions #2

Updated by Martin Honnen over 3 years ago

Thanks for the clarification.

However, that resolution deviates from the way Saxon Java or .NET handle Saxon specific flags (https://www.saxonica.com/html/documentation10/functions/fn/matches.html) 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.

Actions #3

Updated by Norm Tovey-Walsh over 3 years 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'.

Actions #4

Updated by Norm Tovey-Walsh over 3 years ago

  • Status changed from Resolved to Closed

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

Actions #5

Updated by Norm Tovey-Walsh over 3 years ago

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

Actions #6

Updated by Debbie Lockett over 3 years ago

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

Updated by Debbie Lockett over 3 years ago

  • Applies to JS Branch 2 added

Please register to edit this issue

Also available in: Atom PDF Tracking page