You are here: PSPad forum > Bug report / Hlášení chyb > Re: Regex replace with group capture and substitution not working

Re: Regex replace with group capture and substitution not working

#1 Regex replace with group capture and substitution not working

Posted by: therium | Date: 2015-11-18 13:18 | IP: IP Logged

PSPad 4.5.8 (2482) on Windows 7.

I want to replace about 50 footnotes with a different format.

Old format: 1 <#cn1>. blah blah blah

New format: [^1]: blah blah blah

So I selected 2 lines to test the replace on. I did a replace with regex and tried to capture the footnote number. It didn't work. In the replace box, the '\1' is supposed to represent the digits captured in the search box. The screen capture below changes all footnotes to the number one.

imgur.com

Edited 2 time(s). Last edit at 2015-11-18 13:20 by therium.

Options: Reply | Quote | Up ^


#2 Re: Regex replace with group capture and substitution not working

Posted by: pspad | Date: 2015-11-18 15:42 | IP: IP Logged

For substitution use $1, not a \1
See the PSPad help (press F1 in find/replace fialog) for the regular expression examples

Options: Reply | Quote | Up ^


#3 Re: Regex replace with group capture and substitution not working

Posted by: therium | Date: 2015-11-22 13:35 | IP: IP Logged

Super! Thank you.

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2021 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR