regex - Perl: Extracting multiple numbers from string -
could me in correcting me following code. want extract 2 numbers input string.
input string [7:0] xxxx i want '7' , '0' loaded 2 variables (min , max). trying achieve
my ($max, $min); ($max, $min) = $_ =~ /[(\d+):(\d+)]/; print "min: $min max $max\n"; i getting result
use of uninitialized value in concatenation (.) or string @ constraints.pl line 16, <ph> line 165. min: max: 1 regards
[ , ] regex meta characters, have escape them
($max, $min) = $_ =~ /\[(\d+):(\d+)\]/; the brackets used denote character class: [ ... ] matches characters inside it, e.g. [abc] matches a.
Comments
Post a Comment