Singular or plural?

21

1

Here is a list of 30 English nouns in their singular and plural form. Your job is simply to write the shortest regular expression that matches all the nouns in one form and none in the other (easy, all English nouns end in s in plural form right?).

SINGULAR     PLURAL
---------    --------
car          cars
boat         boats
man          men
woman        women
omen         omens
bus          buses
cactus       cacti
spy          spies
pie          pies
louse        lice
mouse        mice
amice        amices
goose        geese
creese       creeses
person       people
child        children
siren        sirens
ox           oxen
foot         feet
tooth        teeth
formula      formulae
minx         minxes
sphinx       sphinges
wife         wives
knife        knives
ion          ions
criterion    criteria
jinni        jinn
zero         zeros
hero         heroes        

Yes, some of the words have alternative forms, but these are the ones we're going to use.

Here is a script that can help you with the testing; just put your regex between the two slashes (/) on the first line.

daniero

Posted 2014-01-16T23:41:22.060

Reputation: 17 193

7Hmm, interesting challenge! I never knew the sphinx one; I always thought it was sphynxes :-P +1 – Doorknob – 2014-01-16T23:48:15.377

5glad you didn't add fish and sheep to the list :) – mniip – 2014-01-16T23:53:24.647

1I'm probably missing something (this is not my first language, and most of us have scarce relationships with them anyways) but shouldn't the 4th entry be "women"? – Tobia – 2014-01-16T23:54:05.847

@Tobia that was a typo, thanks. I also added two words since 30 felt rounder than 28. Hope I didn't mess up for anyone who might have started already. – daniero – 2014-01-16T23:58:53.977

1

@daniero well, 28 is a nice round number too (base 7 or base 28 or ...) (relevant spikedmath comic)

– Justin – 2014-01-17T00:02:21.540

2Typical English esoteric rules - for example, if plural for goose is geese, then how come the plural for moose is not meese? (Its actually moose - a gotcha there) – t0mm13b – 2014-01-17T00:48:33.547

Answers

10

44, or 46 if delimiting // count:

dr|wome|[aglx]e|et|ti|ia|[^u]s$|nn$|^.ic|^me

Boann

Posted 2014-01-16T23:41:22.060

Reputation: 378

2

42 (or 44 with delimiters)

^.(e[^r]|ic)|x.|..me|ia|ti|.l..|nn$|[^u]s$ - Try it online!
^.(e[^r]|ic)|x.|..me|ia|[adjlu]...$|[^u]s$ - Try it online!

Deadcode

Posted 2014-01-16T23:41:22.060

Reputation: 3 022

1

65 or 67

^[lm]i[^n]|^ge|ti|ia|[l|a]e$|ox.|^(wo)?men$|dren|nn$|et|[netro]s$

KevinColyer

Posted 2014-01-16T23:41:22.060

Reputation: 171