in reply to Extraction of numbers in an string

I have the following string

A1=<m,n>:<p,q>:<s,t>...go on

I have to extract values m,n,p,q,s,t from the above string. How do i do it?.

You could use m// to match them:

#!/usr/bin/env perl use strictures; my @v = 'A1=<m,n>:<p,q>:<s,t>...go on' =~ /[mnpqst]/g;

Replies are listed 'Best First'.
Re^2: Extraction of letters from a string
by t-rex (Scribe) on Nov 24, 2016 at 13:19 UTC

    here the m,n,p,q... are numbers which can change based on the user, so writing a regex just to hardcode with numbers won't be a good idea i guess

      How was m,n,p etc. supposed to represent digits? Anyway, if you want to match digits, match digits:

      #!/usr/bin/env perl use strictures; my @v = 'A1=<9,8>:<7,6>:<5,4>...go on' =~ /\d/ag;

        Hi, I have one doubt , what should be changed if double or triple digits are to be considered , as of now the above mentioned code (your solution) splits 10 as 1 0

        I edited my post, as i hastily put it, pls check the edited one, thank you that works :)