[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Regular Expression...



At 13.15 8/1/97, Matt Sansbury wrote:
>I apologize if this question is a newbie one, but I can't seem to find
>the answer...

Don't mind newbie questions.  However, this is not a MacPerl question, but
a general perl question.

>I have created a search engine and am trying to search for multiple
>words that are next to each other in a string. For example, I would
>like a search for "red blue" to match the words red and blue seperated
>by one or more spaces, but not "red green blue." Right now I can only
>get the latter to happen.

#!perl
$text = 'red green blue red    blue';
print $text =~ /(red +blue)/;
__END__

* Next time show us your code so we can have a peek.
* Check out Mastering Regular Expressions <http://www.ora.com/catalog/regex/>
* Read the perlre man page ("Regular expressions" under the MacPerl help menu)

--
Chris Nandor             pudge@pobox.com             http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch