in reply to Regex output incorrect
my $folder_path = "/aboutiso/corp_gov/bod/agendas/2010/"; my $try = "index.html"; my $test = "$folder_path/$try"; $folder_path =~ s#/\w+/[^/]*.\w+$##; print "folderpath: $folder_path\n"; ^D folderpath: /aboutiso/corp_gov/bod/agendas/2010/
If u are trying to knock off the final dir in folder_path then ur regex makes no sense. It looks like u want to knock off the file name and one dir from $test.
my $folder_path = "/aboutiso/corp_gov/bod/agendas/2010/"; my $try = "index.html"; my $test = "$folder_path/$try"; print "folderpath: $test\n"; $test =~ s{/+\w+/+\w+\.\w+$}{}; print "folderpath: $test\n"; ^D folderpath: /aboutiso/corp_gov/bod/agendas/2010//index.html folderpath: /aboutiso/corp_gov/bod/agendas
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex output incorrect
by begood321 (Novice) on Dec 14, 2010 at 02:31 UTC |