[Development] QRegularExpression -- first round of API review

Thiago Macieira thiago.macieira at intel.com
Tue Jan 17 18:40:25 CET 2012


On Tuesday, 17 de January de 2012 15.15.15, Giuseppe D'Angelo wrote:
> 2012/1/17 Thiago Macieira <thiago.macieira at intel.com>:
> > On Tuesday, 17 de January de 2012 02.43.33, Giuseppe D'Angelo wrote:
> >> 1) Support for more pattern options and match options. Right now you
> >> can see them commented in the .h (and there's no code for them), but
> >> adding them is trivial. Any opinions for just enabling them or only
> >> some? In particular, InvertedGreedinessOption for giving a (more or
> >> less) direct replacement of QRegExp::setMinimal, and
> >> AllowDuplicatedNamesOption (see the next point) for duplicated names
> >> in named capturing groups.
> > 
> > Call it NonGreedyOption and I think that should be enabled.
> 
> The name InvertedGreedinessOption came from the fact that it inverts
> the greediness of the quantifiers: * becomes ungreedy, *? becomes
> greedy (the same applies for all other quantifiers). I'll add it
> though.

Keep it as InvertedGreedinessOption then. I thought it only affected * by 
making it be like *?.

> > UseUnicodePropertiesOption: can we reduce the size of the library in
> > certain scenarios if we don't have this option?
> 
> I don't think so, I think we still need PCRE to have its Unicode
> tables for having case insensitive matches.

If there's no gain, then we should let it in.

What does this option cause the engine to do?

> > DontCaptureOption: is this a memory saving mechanism? What else does it
> > do,
> > besides making the capture groups return empty or invalid? If it's just a
> > memory saving option, I'd say let it in.
> 
> It simply disables the non-named capturing groups, so they simply
> group but not capture substrings any more. Named capturing groups
> still work, though. I see it as both an optimizer and syntactic sugar,
> avoiding you to write lots of (?:...) groups if you don't really need
> to capture anything but only group.

But what's the benefit? I've done a lot of () grouping without the "?:" sugar 
to make it not capture. Does it make the matching happen faster? I doubt it. 
Does it give a memory benefit by not capturing?

> > MatchFirstLineOnlyOption and DollarMatchesOnlyAtEndOption: I can't tell
> > from the name only. How do they interact with the MultilineOption? My
> > guess is to leave them out for now. We can always introduce them later.
> 
> Great.

But how do they interact with the MultilineOption? Maybe that will affect the 
option that is there.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120117/36fb8b7c/attachment.sig>


More information about the Development mailing list