Title: RE: regex??
Oops. I swapped the first and last names. Silly me!
Try this instead:
print "Content-type:text/html\n\n";
$i="name and date: Abate, Alfred 02.24.51 Date2: 09/21/00 blablabla";
$i=~/(\w+),\s*(\w+)\s+([\d\.-\/]+)\s+date2:\s*([\d\.-\/]+)/i;
($lname, $fname, $
Title: RE: regex??
Try this:
print "Content-type:text/html\n\n";
$i="name and date: Abate, Alfred 02.24.51 Date2: 09/21/00 blablabla";
$i=~/(\w+),\s*(\w+)\s+([\d\.-\/]+)\s+date2:\s*([\d\.-\/]+)/i;
($fname, $lname, $date1, $date2) = ($1, $2, $3, $4);
print "name: $
one small suggestion for Lees version:
($name,$date1,$date2) = $input =~/^name and
date:\s(\w+,\s\w+)\s(\d\d$div\d\d$div\d\d)\sDate2:\s(\d\d$div\d\d$div\d\d)/;
- Original Message -
From: "Lee Goddard" <[EMAIL PROTECTED]>
To: "shil" <[EMAIL PROTECTED]>; "activeperl"
<[EMAIL PROTECTED]>
HTH,
Lee
=TasK:
Input
name and date: Abate, Alfred 02.24.51 Date2: 09/21/00 blablabla
output
Name =Abate Alfred
Date=02.24.51
Date2=09/21/00
=cut
$div = "[.-/]";
$input = 'name and date: Abate, Alfred 02.24.51 Date2: 09/21/00 blablabla';
$input =~/^name and
date:\s(\w+,\s\w+)\s(\d\d$div\d\d$
these regexs below will pick up the name and dates (you'll need to put some
logic in with these too):
$_="name and date: Abate, Alfred 02.24.51 Date2: 09/21/00 blablabla";
/(\w*), (\w*)/;
print "name; $1 $2\n";
/(\d\d).(\d\d).(\d\d)/;
print "date: $1.$2.$3\n";
m#(\d\d)/(\d\d)/(\d\d)#;
print "dat
Hi guys,
I really have problem with this regex.Here I have the string
containing two dates separated by either ' / ' or ' . ' or ' - '. I have to
retrieve both the dates and string which comes before the first date and
after it.
Input
name and date: Abate, Alfred 02.24.51 Date2: 09/21/00 bl