That is basically what I did for the non problematic replacements.  The ones 
that not only need the captured text, but also need the rest of the text I 
didn't bother implementing

Thanks.

-----Original Message-----
From: Interest <interest-boun...@qt-project.org> On Behalf Of Thiago Macieira
Sent: Thursday, December 1, 2022 8:14 PM
To: interest@qt-project.org
Subject: Re: [Interest] QRegularExpression for replace

On Thursday, 1 December 2022 11:43:39 PST Scott Bloom wrote:
> Im looking for a way using QRE to do something like the following
> 
> auto regEx = QRegularExpression( "(?<name>.*)" ); if ( regEx.match( 
> string ) )
>                 auto newString = regEx.replace( string, "${name}" );

This requires having a parser for the replacer too, which is not something we 
currently have.

The QRegularExpressionMatch result gives you all the regions in the string 
where captures were found, so you can  do this yourself if you know your 
captures.

--
Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering



_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to