Flooyd space

Navigation

Home‎ > ‎

Perl

### Regular expression stuff from the book <regular expression>
### TODO add reference detail (page/chapter)


### "look around"
$test = "see Jeffs book";
$test =~ s/(?<=Jeff)(?=s)/'/g;
print "$test \n";

### Start of match ( or end of previous match): \G
$test = "abcde";
$test =~ s/\Gx?/!/g;
print "$test \n";             ### expect !abcde
$test =~ s/\x?/!/g;
print "$test \n";             ### expect !a!b!c!d!e

Attachments (1)

  • logfile.pl - on Jan 15, 2009 8:53 AM by Haisheng Wu (version 1)
    1k Download