Comments (4)
This reminds me that I have sometimes wished that we had named groups, which serves a kind of commentary function. But the angle brackets used in C# regexes wouldn't be copacetic, and the colons might be just the right substitute. XSLT's regex-group
could then be adjusted to allow integers or strings.
At any rate, comments and named groups would make regular expressions more declarative, and therefore more QT-like.
from qtspecs.
Thanks, itβs possible named captures could be made available through a map. Perl uses $+{name} to refer to them in the substitution part, and also offers (?'NAME'pattern) which might work.
A thing to watch for with named groups is that in some systems (e.g. .NET) the named groups are not included in the numbering, and in others (including Perl) they are.
We can't use Perl's syntax for comments, because it's line based, and newlines in select attributes go away under attribute value normalization during parsing (or become spaces).
from qtspecs.
The Perl syntax for comments ('#' up to newline) is clearly troublesome given XML attribute value normalization which kills newlines.
Coming up with any other syntax is difficult because anything we do might clash with some existing convention or prevent us adopting some regex feature that we're not currently aware of.
Perhaps we could do something along the lines of "literate regular expressions" - see https://hackaday.com/2020/09/11/linux-fu-literate-regular-expressions/
Or just encourage people towards invisible XML.
from qtspecs.
I suggest that we allow comments if the flag '#' is present, and that comments start with '#' and end with '#' or the end of the regex string. I don't think we can overload flag x
to allow both comments and whitespace for backwards compatibility reasons. A '#' can be escaped by writing \#
or [#]
.
I'd suggest treating named capturing groups as a separate issue.
from qtspecs.
Related Issues (20)
- parse-json: liberal parsing HOT 2
- fn:json-to-xml: 'number-parser' option HOT 2
- Backwards incompatibility caused by use of EBV in callback functions HOT 4
- Allow dynamic collations in XQuery "order by" and "group by" HOT 11
- CSV parsing - "blank" rows HOT 3
- CSV row delimiter - allowed values HOT 5
- Functions to manage namespace usage HOT 2
- Incorrect note for `fn:some` and `fn:every` HOT 5
- fn:format-number: relax restrictions on exponent-separator (possibly minus-sign, percent, per-mille) HOT 13
- Potential (low-risk) Ambiguities in XPath EBNF
- parse-csv() - simplify output HOT 1
- Spec fn:message #id using old name fn:log
- simplifying the language - attempt 2 HOT 22
- Simplifying match templates HOT 11
- Formatting XPath/XQuery HOT 2
- discussion - language pragmas HOT 6
- deep-equal() - option to compare functions liberally HOT 25
- fn:format-number: further notes
- fn:deep-equal: significant children HOT 2
- fn:ucd HOT 25
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qtspecs.