Notepad++ change all 'xx' for 'xx++' -
have way numerate following text
('xx', 'link 001'),
('xx', 'link 002'),
('xx', 'link 100');
to
('001', 'link 001'),
('002', 'link 002'),
('100', 'link 100'),
like while
while($x = 001; $x <= 100) { $xx == $x++; }
assuming text laid out exactly posted:
('xx', 'link 001'), ('xx', 'link 002'), ('xx', 'link 100'); the following regex search should work:
find:
'\w+', 'link (\d+)' replace:
'\1', 'link \1' breaking down bit-by-bit you,
' - searches '
\w - searches alphanumeric character or underscore.
+ - instructs notepad++ find preceding sequence 1 or more times. in combination \w, looks 1 or more alphanumeric characters/underscores. match xx.
' - '. @ point, we're looking ', followed 1 or more alphanumeric characters, followed '.
, 'link - literal search, time comma followed space followed ' followed word link followed space.
( - starts grouping. between parentheses (()) can later identified using \1, \2, etc. 1 identified \1 since it's our first group.
\d - searches digit.
+ - again, matches 1 or more of preceding characters. we're looking 1 or more digits.
) - closes grouping. \1 hold results of search 1 or more digits.
' - final ' in text.
now replace. simpler. in nutshell, takes digits "find" regex found , replaces multi-character sequence them, puts else way was.
' - literal, first '.
\1 - holds results of multi-digit search "find" regex used. link 001, hold 001; link 002, hold 002; etc. here's magic happens: alphanumeric sequence found \w+ replaced digits \d+ found.
', 'link - literal. insert ', 'link. we're putting text there.
\1 - same multi-digit grouping last \2 was. once again, 001 link 001, 002 link 002, etc. we're replacing number there... itself.
' - closing '.
Comments
Post a Comment