sabrogden / Ditto

Ditto is an extension to the Windows Clipboard. You copy something to the Clipboard and Ditto takes what you copied and stores it in a database to retrieve at a later time.
https://ditto-cp.sourceforge.io/
3.93k stars 208 forks source link

AsciiTextReplaceRegex replace with submatch #720

Closed trialsin closed 2 months ago

trialsin commented 2 months ago

Hi,

I'm trying to use AsciiTextReplaceRegex to replace some parameter formatting to another format.

For example:

INPUT SAMPLE:
...FUN.CDG_ORGAO,:REF_ANOMES,FUN.CDG_ORDEM...

DESIRED OUTPUT:
...FUN.CDG_ORGAO,{REF_ANOMES},FUN.CDG_ORDEM...

The regular expression I'm using is:

clip.AsciiTextReplaceRegex(":(\w+)", "{$1}");

The problem is that the common submatch syntax used in regular expressions for replacement (like $1, $2 etc.) does not seem to be working in this case.

When I run the replacement, the $1 is not being substituted with the capturing group.

Does ChaiScript support using capturing groups in the replacement string? If so, what is the proper syntax?

image

UPDATE:

I don't know what happened, but I tried again today and everything has worked like expected. Sorry for the trouble!