Regex. Digits, Letters and Dashes. what am I doing wrong?

Giganews Newsgroups
Subject: Regex. Digits, Letters and Dashes. what am I doing wrong?
Posted by:  Shapper (mdmou…@gmail.com)
Date: Thu, 30 Aug 2012

Hello,

I need to use a Regex to check if a String is a match where:
1 - Allow Digits, Letters and Dashes (-);
2 - Allow the string to be empty.

I have the following: "^\w+-$"

But this is not working. What am I missing?

Thank You,
Miguel

Replies