by PleegWat » Thu Aug 24, 2006 8:53 pm
It's hard to make a regex that detects multiple patterns. The first 2 would be caught by the following:
/alt (\w+)/i (Match 1)
The third would be caught by:
/(\w+) alt/i (Match 1)
The fourth:
/(\w+)'s alt/i (Match 1)
The last 2:
/(\w+)('s)? alt/i (Match 1)
Potentially, all 4:
/(alt (\w+)|(\w+)('s)? alt)/i (match 2, I think)
When making regexes like these you should study the matter a bit and test thoroughly. It's always better to have consistent notes and not use regexes like these.
The last one would act unpredictably in a note like:
Leatherworker alt Rusky
I <3 /bin/bash