#!/usr/bin/perl while (<>) { print if m!(-?\d*?.?\d+)to(-?\d*?.?\d+)!m; print "$1\n$2\n"; print "$_\n" for ($1 .. $2); } giving the result: [barry@localhost]$ ./g 4.5to6.8 4.5to6.8 4.5 6 4 5 6 the "4.5" extracts properly but not the "6.8", it gets truncated to "6"....?
In reply to Matching two real numbers in a string using regex by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |