Regexp Help for \W less [.-_]

Regexp help. How do I write "all non-alphanumeric characets except .
(period) - (dash) and _ (underscore)"

Thanks,
T.

Hi --

···

On Sun, 7 Aug 2005, Trans wrote:

Regexp help. How do I write "all non-alphanumeric characets except .
(period) - (dash) and _ (underscore)"

Just negate the things you don't want (with _ being subsumed in \w):

   /[^\w.-]/

David

--
David A. Black
dblack@wobblini.net

re = %r/[^A-Za-z0-9._-]/

or depending on usage, you may want

   re = %r/^\s*[^A-Za-z0-9._-]\s*$/

or something close

cheers.

-a

···

On Sun, 7 Aug 2005, Trans wrote:

Regexp help. How do I write "all non-alphanumeric characets except .
(period) - (dash) and _ (underscore)"

--

email :: ara [dot] t [dot] howard [at] noaa [dot] gov
phone :: 303.497.6469
Your life dwells amoung the causes of death Like a lamp standing in a strong breeze. --Nagarjuna

===============================================================================

Thanks Ara. Worked.

David A. Black wrote:

Just negate the things you don't want (with _ being subsumed in \w):

   /[^\w.-]/

Even better.

(I thought I tried that w/o success, but on reflection I may have
mistakenly used \W instead of \w.)

Thanks for the help,
T.