>From: Steve Willer <willer@interlog.com> >To: fwp@technofile.org >Subject: [FWP] Gender differentiation >Date: Fri, Jul 2, 1999, 3:01 AM > > > This post isn't nearly as interesting as the subject implies. > > I've been trying to come up with a way to match "men" in any string, but > not get a false match from "women". > > I would very much like to use something like: > > /(^|[^o])men/i > > ...but that doesn't work. Is there anything that does work, fun or > otherwise? # Thru process of elimination, we can see - while (<DATA>) { #print $_ if /men/io; # This only matches 'embedded' men/women... #print $_ if /(^wo)men/io; # This only matches women... #print $_ if /[^wo]men/io; # This matches nothing... #print $_ if /men\b/io; # Same as first test... print $_ if /\bmen\b/io; # This only matches embedded men... } __DATA__ Some women walking. Some men walking. Woman is singular. Man is singular. The manadin orange was rotten. There are men-working here. Dancing women prove sexist, news at 11. HTH, -Sneex- :] FCCJ Data Security Group ______________________________________________________________________ Bill Jones Data Security Specialist http://www.fccj.org/cgi/mail?dss ==== Want to unsubscribe from Fun With Perl? ==== Well, if you insist... Send mail with body "unsubscribe" to ==== fwp-request@technofile.org