You can use the following piece of code.
#!/usr/bin/perl -w use strict; my $filename = 'regex_data.txt'; open INPUTFILE , $filename or die "Cannot Open : $filename : $!"; while ( <INPUTFILE> ) { chomp $_; print "$2\n" if ( $_ =~ /^.*(start\:)(.*)(stop\:)/gi ) } close INPUTFILE;
Assume that the file "regex_data.txt" contains your data. This code will print only the data between the last "start:" - "stop:" pair.
Hope this will help you !
In reply to Re: Regex latest match?
by vennirajan
in thread Regex latest match?
by JykkeDaMan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |