Matching in perl -


i new perl. trying text in between 2 dots of line, program returns entire line.

for example: have text looks sampledata 1,2 perl .version 1_1.

i used following match statement

$x =~ m/(\.)(.*)(\.)/; 

my output $x should version 1_1 getting entire line match.

i appreciate help. thanks.

in code, value of $x not change after match.

when $x matched m/(.)(.*)(.)/, 3 capture groups contain '.', 'version 1_1' , '.' respectively (in order given). $2 give 'version 1_1'.

considering might want part 'version 1_1', need not capture 2 dots. code give same result:

$x =~ m/\.(.*)\./; print $1;  

Comments

Popular posts from this blog

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -