Re: split and grouping in regexp
- From: pangj@xxxxxxxxxxxxx (Jeff Pang)
- Date: Tue, 31 Oct 2006 09:29:07 +0800 (GMT+08:00)
I'm using:
my ( $yyyy, $mm, $dd ) = split /(-|\/)/, $yyyymmdd;
but it doesn't work.
Hello,
try split /\W/,$string pls.
$ perl -le '$str="2006/10/31";my ( $yyyy, $mm, $dd ) = split /\W/, $str;print join " ",$yyyy, $mm, $dd'
2006 10 31
$ perl -le '$str="2006-10-31";my ( $yyyy, $mm, $dd ) = split /\W/, $str;print join " ",$yyyy, $mm, $dd'
2006 10 31
--
Books below translated by me to Chinese.
Practical mod_perl: http://home.earthlink.net/~pangj/mod_perl/
Squid the Definitive Guide: http://home.earthlink.net/~pangj/squid/
.
- Prev by Date: Re: [SPAM DETECT] split and grouping in regexp
- Next by Date: RE: split and grouping in regexp
- Previous by thread: Re: split and grouping in regexp
- Next by thread: Perl Code Creating a Binary File for MATLAB
- Index(es):
Relevant Pages
|