Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Thanks for looking!#!/usr/bin/perl use strict; use warnings; print "\n"; my $file_1 = '-/yf/-/22211_01_09_2000_XYz.pdf'; # Just to show that the "hyphen" can be in any place in the path. my $file_2 = '_/gt/-/02239_04_04_1989_PkW.pdf'; my $file_3 = '-/xy/-/02239_04_04_1989_PkW.pdf'; my ($zip) = $file_1 =~ /^[\w\-]+\/[\w\-]+\/[\w\-]+\/(\d{5})_/; print "\n\n *$zip* \n\n\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Matching hyphens in file path to extract zip code
by haukex (Archbishop) on Feb 05, 2020 at 14:59 UTC | |
by Anonymous Monk on Feb 05, 2020 at 15:13 UTC | |
by haukex (Archbishop) on Feb 05, 2020 at 15:17 UTC | |
by Anonymous Monk on Feb 05, 2020 at 15:28 UTC | |
by Anonymous Monk on Feb 05, 2020 at 23:24 UTC | |
|
Re: Matching hyphens in file path to extract zip code
by hippo (Archbishop) on Feb 05, 2020 at 15:28 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |