in reply to Regex question : How to match \w and just the dash

Think I have a glimmering... but just barely... of what your input might be. Input, please, and if ([A-Za-z\-])+ is not the desired out, a sample of that too? In fact, a tight sample of the script would make it MUCH easier to try to help.
  • Comment on Re: Regex question : How to match \w and just the dash

Replies are listed 'Best First'.
Re^2: Regex question : How to match \w and just the dash
by hmbscully (Scribe) on Dec 17, 2004 at 21:38 UTC
    I'll give the offered solutions a go, they make sense. I did not realize that \W included the underscore. Nice to know. The input will be name and address fields on an order form.
      The input will be name and address fields on an order form.

      Then won't they contain spaces?



      ($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss')
      =~y~b-v~a-z~s; print

      Just nit-picking, but keep in mind that \w and \W are not the same thing (note the case / capitalization). In fact, they are each other's complement: a character matched by \w will not be matched by \W, and vice versa.

      -- 
              dakkar - Mobilis in mobile
      

      Most of my code is tested...

      Perl is strongly typed, it just has very few types (Dan)