On Wed, 2003-12-24 at 10:41, Tarus Balog wrote:
> I need a regular expression for the following:
>
> The characters "Re: " followed by 2 to 8 capital letters, followed by a
> comma and space ", " and then three random words, separated by spaces.
Hi, Tarus --
How about this: /^Re: [A-Z]{2,8}, \S+ \S+ \S+$/
Attached are a perl script and some test data. The script prints only
the lines from stdin that match the above re.
[EMAIL PROTECTED] mtodd]$ cat re-test-data | ./re.pl
Re: CEGRUJAV, finally the door
Re: WPXPM, them and came
Re: OIJ, what? what? what
HTH,
-- Matthew
#!/usr/bin/perl -n
print if /^Re: [A-Z]{2,8}, \S+ \S+ \S+$/
Re: CEGRUJAV, finally the door
Re: WPXPM, them and came
Re: OIJ, what? what? what
Re OIJ, what? what? what
re: OIJ, what? what? what
Re: O, what? what? what
Re: OIJ what? what? what
Re: OIJ, what? what? what? what
Re: OIJOIJOIJ, what? what? what
--
TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
TriLUG Organizational FAQ : http://trilug.org/faq/
TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
TriLUG PGP Keyring : http://trilug.org/~chrish/trilug.asc