W3C home > Mailing lists > Public > public-qt-comments@w3.org > September 2009

Three requests related to regular expressions

From: Krzysztof Maczyński <1981km@gmail.com>
Date: Wed, 2 Sep 2009 11:59:10 +0200
Message-ID: <943562740909020259v33ae153cyde01d6a5e61b202b@mail.gmail.com>
To: public-qt-comments@w3.org
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

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:28 UTC