in reply to Regex capture between word and punctuation
And I may have reformatted the text, but my output looks like:#!/usr/bin/perl use warnings; use strict; while(<DATA>) { chomp; next unless ( m/(\.|\,|\?)$/ ); my $len = length($_); my $pos = index(lc($_), " it "); if ( $pos > -1 ) { my $delta = $len - $pos - 4; my $string = substr($_,$pos + 4,$delta); print "Substring = $string\n"; } } __DATA__ Tim created the Module List in August 1994 and maintained it manually +till April 1996. By that time Andreas had implemented the Perl Authors Upload Server (P +AUSE) and it was happily feeding modules through to the CPAN archive +sites. Since PAUSE held a database of module information which could be maint +ained by module authors it made sense for the module listing part of +the Module List to be built from that database.
Update: fixed the case sensitivity issue.C:\Code>perl substring.pl Substring = manually till April 1996. Substring = was happily feeding modules through to the CPAN archive si +tes. Substring = made sense for the module listing part of the Module List +to be built from that database.
|
|---|