Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Regex whitespace and non-word puzzler

Expand Messages
  • hooyar66
    ... a backslash. ... 777 0095 ... training! ... Thanks Randal that s perfect, yes I should have stated non-word- characters . The caret ^ used to negate
    Message 1 of 3 , Jan 31, 2007
    • 0 Attachment
      --- In perl-beginner@yahoogroups.com, merlyn@... wrote:
      >
      > >>>>> "hooyar66" == hooyar66 <pcbcad@...> writes:
      >
      > hooyar66> I want to be able prefix all non-words EXCEPT SPACES with
      a backslash.
      >
      > you mean non-word-characters?
      >
      > so the set of \W without space?
      >
      > That'd be [^\w ], so s/([^\w ])/\\$1/g
      >
      > Pretty simple, once you understand set arithmetic. :)
      >
      >
      > --
      > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503
      777 0095
      > <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
      > Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
      > See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
      training!
      >

      Thanks Randal that's perfect, yes I should have stated "non-word-
      characters".

      The caret ^ used to negate instead of as a 'beginning' marker
      confused me for a while, had to RTFM ;-)

      NJH
    Your message has been successfully submitted and would be delivered to recipients shortly.