data67 has asked for the wisdom of the Perl Monks concerning the following question:
Example:
Don Phillie Johnson
Alexander simon
simon DeGauo
simon DeGauo Henderson
Alex Johnson
Alex Johnson Stevens
You see i need to come up with somewhat of a smarter regex that can go do this.
Now one thing that i forgot to mention in the scenerio is that the flat-file has different doctors.
so if you had something like the following it is ok:
123!simon DeGauo!rm-200!Dr. Andre
123!simon DeGauo!rm-200!Dr. Banks
Now you see i am gonna have to do a regex that looks at both the patient name (variation sensative) and the doctor.
I know the explanation is not the best but i think you guys can look at the follwing and get a clue also.
$patient = "Alex"; $new_doc = "Kessler"; open (REC, "record.data"); @data = <REC>; close (REC); foreach $line (@data) { my ($id, $patient, $room, $doc) = split (/!/, $line); if (($patient =~ /($new_patient)/i) && ($doc =~ $new_doc)) { print "$line\n"; } else { print "NO PATIENT BY THAT NAME\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regular expression issue
by DamnDirtyApe (Curate) on Aug 02, 2002 at 22:14 UTC | |
by data67 (Monk) on Aug 06, 2002 at 16:15 UTC | |
|
(shockme) Re: regular expression issue
by shockme (Chaplain) on Aug 03, 2002 at 03:46 UTC | |
by data67 (Monk) on Aug 06, 2002 at 16:21 UTC | |
|
Re: regular expression issue
by tommyw (Hermit) on Aug 06, 2002 at 16:27 UTC |