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

Re: Three requests related to regular expressions

From: David Carlisle <davidc@nag.co.uk>
Date: Tue, 15 Sep 2009 10:50:18 +0100
Message-Id: <200909150950.n8F9oIkp028171@edinburgh.nag.co.uk>
To: mike@saxonica.com
Cc: public-qt-comments@w3.org


> I'd like to see evidence that this [allowing regexpo to match an empty
> string anchored at the start] is needed in the form of use cases that
> can't readily be solved using existing facilities.

Usually this can be worked round by concatenating a fixed string to the
start of both the search text and the regexp, but this is rather
unnatural.

see the xsl-list thread here:

http://markmail.org/message/hniu3hkp44rgyfd2

where I stuck a ":" into the code for this reason, and a list reader
asked why it was there...


> We did consider, as an alternative to the new option setting in (1) above,
> providing a function that constructs a regular expression from a string by
> escaping any special characters. However, the solution in (1) seemed to be
> simpler and sufficient to meet most of the use cases. If you have a use case
> that isn't satisfied by this facility, it would be interesting to see
> it.

The flag option is simpler if you want to do a simple string search
rather than  a regexp search, however the quote function is far nore
useful if, as in the above xsl-list thread, you are constructing a
regexp out of data extracted from the source. For example, if you have
two attributes a and b and you want to search some text for all
occurrences of the value of a separated by white space from the value of
b then a nice way is to seach for the regexp

concat(regexp-quote(@a),'\s+',regexp-quote(@b))

I don't think a flag (if I understand it correctly from your
description) would address this.


> Please note, it's convenient to the WG if requests for enhancements can be
> raised in the public W3C bugzilla system as bugs against the 2.1 working
> drafts.

It's hard for the public to think of raising an issue against the 2.1
drafts until the drafts are, well, public... any chance of that
happening even as an early WD state?

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________
Received on Tuesday, 15 September 2009 09:51:10 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:40 UTC