[Interest] QRegularExpression for replace

Thiago Macieira thiago.macieira at intel.com
Fri Dec 2 05:13:45 CET 2022


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





More information about the Interest mailing list