regex - How does pattern matching works using perl -


i have variables a:b:c a:b:d c:d:e , need output displayed a-b a-b c-d

i try following code

$res="a:b:c a:b:d c:d:e";  $res=~s/\:/\-/g;  $res=~s/..$//mgs; print "$res\n"; 

but did not receive output

use strict; use warnings; $res = "a:b:c a:b:d c:d:e"; $res =~ s{([a-z]):([a-z]):[a-z]}{$1-$2}ig; 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -