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

Re: [FWP] Gender differentiation



Edward M. Perry wrote:
> I thought we also wanted to match 'snowmen' while leaving 'snowwomen'
> alone. If there is a single regex to do that, that would be _too_ much
> fun :)

i -think- this will do it:

/((?!wo)..|^.?)men/i;

we want: 
- the string 'men',
- preceded by either:
  - two characters which are not 'wo', or
  - just one character, or
  - zero characters.

here's the script and data i tested the regex with:

while (<DATA>) {
  print if /((?!wo)..|^.?)men/i;
}
  
__DATA__
Some women walking.
Some men walking.
Woman is singular.
Man is singular.
Men is plural.
There are men-working here.
Dancing women prove sexist, news at 11.
Snowmen are built by snowwomen.
Omen!  Y2K!
Women usually know what they're talking about.
Snowmen.
Snowwomen.

--
Steve Lane <sml@zfx.com>

==== Want to unsubscribe from Fun With Perl?
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org