[tpm] Dumb regex question

Alex Beamish talexb at gmail.com
Tue Aug 21 09:45:07 PDT 2007

On 8/21/07, Madison Kelly <linux at alteeve.com> wrote:
> For the life of me, I can't seem to get a simple regex working...
> All I want is to be able to match a word-character string that may have
> a hyphen in it.
> So:
> mizu-bu         # should match
> alteeve         # should match
> m!zu-bu         # should not match
> a|teeve         # should not match
> Someone mind hitting me with a clue-stick? Google and perldoc have
> failed me so far (though I readily admit fault here) ...

So /[a-z-]+/ doesn't work? What have you tried?

A dash needs to be at the end of a regex so it isn't interpreted as part of
a range. If in doubt, backslash it.

Alex Beamish
Toronto, Ontario
aka talexb

ps You could probably get an answer on IRC .. if you dare. ;)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/toronto-pm/attachments/20070821/bd243284/attachment.html 

More information about the toronto-pm mailing list