> -----Original Message-----
> From: David Draley [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 20, 2001 12:35 PM
> To: [EMAIL PROTECTED]
> Subject: reg exp
>
>
> hello -
>
> I am trying to search a <file> for any sentence that ends in
> "." or "?" I
> want to only print those sentences that end with "." or "?" I
> am having
> trouble with the reg expression syntax...
>
> ------------------
>
> while (<file>)
> {
> $file=<file>;
> if(/\.\?$/){
> print "$only_sentences_that_end_with_._or_?";
> }
> }
But that requires the sentence to end with the sequence ".?"
Since you want to match only a single character, use a
character class:
print $file if /[.?]$/;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]