in reply to Problem with regexp to match
/ --> \/
If I where you I'd change delimiter and try m{REGEX} instead of m/REGEX/ .
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
there where more issues, but this works for me ( perl -dE0 starts the debugger )
DB<25> @m = qw{01/LC-13/E10GbE-1 01/LC-13/E10GbE-1,01/LC-14/E10GbE- +1} DB<26> say join ":", m{\d\d/\w+-(\d+)/\w+-(\d+),?}g for @m 13:1 13:1:14:1 DB<27>
If the snippets don't always start with \d\d change it to \d+
If I where you I'd consider spliting on , and then / .
Then applying a simple regex, should be more stable and maintainable.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Problem with regexp to match
by Bod (Parson) on Oct 14, 2021 at 17:36 UTC |