Three requests related to regular expressions

Dear WG,

The following 3 requested features (suitable for XPath 2.1, I presume)
are motivated by something I've tried to do at work recently (amd used
a workaround).

1. Please provide versions of matches, replace and tokenize that do
not treat their argument as a regular expression. The use case is to
deal with trimming, extracting or otherwise processing of arbitrary
strings, potentially read from some input and not hard coded in the
expression.

2. Please lift the requirement that some functions (replace, tokenize)
cannot work with a regular expression matching the empty string when ^
or $ is involved. These should be thus consistently treated as virtual
characters for the purpose of matching.

3. This takes 1. a bit further. I sometimes need (not only in XPath,
also e.g. in ECMAScript, but that's another pair of shoes) a regular
expression that matches only one string which is computed, not known
in advance. A function producing such an expression from any string
would be useful.

ad 3.
Note 1. If there were a universal escape characted, 3. would be easy
to do manually - interleave the string with one of the same length
consisting of escape characters. Unfortunately, there isn't. Worth
raising with XML Schema WG?
Note 2. The function in 3. would better be specified syntactically
with simple escaping mechanisms applied as necessary, not up to
equivalence. This would enable subsequent slight tweaks to the result,
often desirable, before using it as a regular expression.

Received on Wednesday, 2 September 2009 09:59:51 UTC