in reply to Comment mark
This works:
#!/usr/bin/perl -w use strict; my @data = ('# Version: 1.11', '* Version: 1.11', 'Version: 1.11', '/* Version: 1.11'); foreach my $row (@data) { if( $row =~ m/^([\#\*] | \/\* )? \s*version:?\s+ (\d+\.\d+|)/ix) { print "$row \t $2 \n"; } }
and outputs:
# Version: 1.11 1.11 * Version: 1.11 1.11 Version: 1.11 1.11 /* Version: 1.11 1.11
The regexp looks for lines whixh start either with # or * or with /* or none of these.
|
|---|