RegEx Replacement when only match of pos (ie no char)

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
hagchr
Automation Wizard
Posts: 327
Joined: Mon Jul 05, 2010 7:53 am
Location: Stockholm, Sweden

RegEx Replacement when only match of pos (ie no char)

Post by hagchr » Thu Sep 24, 2015 10:26 am

Sorry - wrong forum - have reposted in Enhancement Suggestions



Hi, I once raised this as a technical question but never as an enhancement suggestion:

viewtopic.php?f=2&t=8297

Not sure of difficulty, but one can wish anything, right? Not sure from when, but later versions of Perl (at least 5.18 not sure of earlier) seem to support it.

Small example to illustrate. Some text with different indentations and I want to adjust all to be indented just 1 tab. Since current version does not replace where there is a match of position but no characters, it will not replace in line 3.

Code: Select all

LabelToVar>Data,source
Let>tmp0=(?m-s)^([ ]|\t|$)*

RegEx>tmp0,source,0,m,nm,1,\t,res
MDL>res

/*
Data:
   Some text
        Some text
Some text
              Some text 
    Some text
*/

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts