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

Re: Use s/// to remove non-words BUT keep whitespace?

Expand Messages
  • hooyar66
    Er... yes I ve tried it. I want to first replace non-word characters with _ , which changes whitespace too. To return my intentional whitespace I then have to
    Message 1 of 6 , Sep 1, 2006
    • 0 Attachment
      Er... yes I've tried it.

      I want to first replace non-word characters with "_", which changes
      whitespace too. To return my intentional whitespace I then have to
      convert all instances of "_" back to whitespace.

      Any _help_ appreciated.


      --- In perl-beginner@yahoogroups.com, Paul Archer <tigger@...> wrote:
      >
      > Is there any particular reason that
      > $string =~ s/\W/ /g
      > won't work for you? Have you tried it?
      >
      > Paul
      >
      >
      > 1:52pm, hooyar66 wrote:
      >
      > > Is there a better way of doing this?
      > >
      > > $string =~ s/\W/_/g;
      > > $string =~ s/_/ /g;
      > >
      > > I want to remove all non-std characters EXCEPT for whitespace.
      With
      > > the two statement method above it's slow and I am having to change
      > > whitespace to "_" and then back again.
      > >
      > > Thanks
      > > NJH
      > >
      > >
      > >
      > >
      > >
      > > Unsubscribing info is here: http://help.yahoo.com/help/us/groups/
      groups-32.html
      > > Yahoo! Groups Links
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      >
      >
      >
      > --------------------------------------------------------------------
      ------
      > "As democracy is perfected, the office represents, more and more
      closely,
      > the inner soul of the people. We move toward a lofty ideal. On some
      great
      > and glorious day the plain folks of the land will reach their
      heart's
      > desire at last, and the White House will be adorned by a downright
      moron."
      > - H. L. Mencken, in the Baltimore Sun, July 26, 1920
      > --------------------------------------------------------------------
      ------
      >
    • merlyn@stonehenge.com
      ... Lou hey look what I found Lou does this help? Lou http://www.cs.tut.fi/~jkorpela/perl/regexp.html Date of last update: 2000-10-30 And even with that
      Message 2 of 6 , Sep 1, 2006
      • 0 Attachment
        >>>>> "Lou" == Lou Hernsen <lhernsen1015@...> writes:

        Lou> hey look what I found
        Lou> does this help?

        Lou> http://www.cs.tut.fi/~jkorpela/perl/regexp.html

        "Date of last update: 2000-10-30"

        And even with that update, it looks like it leaves out a bunch of
        Perl's regex features that were available at the time. It looks
        very perl4-ish.

        Why not just use the standard "perldoc perlre" for reference,
        and "perldoc perlretut" for a tutorial?

        --
        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!
      • hooyar66
        Thanks Paul/Lou Friday afternoon brain-lapse...zzzzz ... change ... groups/ ... -- ... some ... downright ... --
        Message 3 of 6 , Sep 1, 2006
        • 0 Attachment
          Thanks Paul/Lou

          Friday afternoon brain-lapse...zzzzz

          --- In perl-beginner@yahoogroups.com, "hooyar66" <pcbcad@...> wrote:
          >
          > Er... yes I've tried it.
          >
          > I want to first replace non-word characters with "_", which changes
          > whitespace too. To return my intentional whitespace I then have to
          > convert all instances of "_" back to whitespace.
          >
          > Any _help_ appreciated.
          >
          >
          > --- In perl-beginner@yahoogroups.com, Paul Archer <tigger@> wrote:
          > >
          > > Is there any particular reason that
          > > $string =~ s/\W/ /g
          > > won't work for you? Have you tried it?
          > >
          > > Paul
          > >
          > >
          > > 1:52pm, hooyar66 wrote:
          > >
          > > > Is there a better way of doing this?
          > > >
          > > > $string =~ s/\W/_/g;
          > > > $string =~ s/_/ /g;
          > > >
          > > > I want to remove all non-std characters EXCEPT for whitespace.
          > With
          > > > the two statement method above it's slow and I am having to
          change
          > > > whitespace to "_" and then back again.
          > > >
          > > > Thanks
          > > > NJH
          > > >
          > > >
          > > >
          > > >
          > > >
          > > > Unsubscribing info is here: http://help.yahoo.com/help/us/
          groups/
          > groups-32.html
          > > > Yahoo! Groups Links
          > > >
          > > >
          > > >
          > > >
          > > >
          > > >
          > > >
          > >
          > >
          > >
          > > ------------------------------------------------------------------
          --
          > ------
          > > "As democracy is perfected, the office represents, more and more
          > closely,
          > > the inner soul of the people. We move toward a lofty ideal. On
          some
          > great
          > > and glorious day the plain folks of the land will reach their
          > heart's
          > > desire at last, and the White House will be adorned by a
          downright
          > moron."
          > > - H. L. Mencken, in the Baltimore Sun, July 26, 1920
          > > ------------------------------------------------------------------
          --
          > ------
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.