30 mar 2010

Zamiana tekstów w perlu

#!/usr/bin/perl
#use strict;
#use warnings;

print "Hello, World...";
$content = '<link rel="stylesheet" href="/zabytki,2,,,,informacje.html">';

$string = $content;
$string =~ s/\<link rel=\"stylesheet\" href=\"([^\"]+)\">/http:\/\/www.wolakorybutowa.pl$1/;
print $string;
30 mar 2010

Wyrażenie regularne w perlu

#!/usr/bin/perl
#use strict;
#use warnings;

print "Hello, World...";
$content = '<link rel="stylesheet" href="/pogoda.091005.css">';

if($content =~ /^\<link rel=\"stylesheet\" href=\"\/(.+)\"/) {
    $styl_link = $1;
 print $styl_link;
}