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

297Re: [Clip] Use RegExp to change case?

Expand Messages
  • lonewolf_tamu
    May 6, 2005
      Hi all

      I am attempting to implement Perl regexp expressions to take
      advantage of "non-greedy" matching. Unfortunately, I am not very
      familiar with Perl.

      I have had partial success by modifying the script below, posted more
      than 2 years ago. This script seems to operate on individual blocks
      of text seperated by blank lines. I need it to treat the entire
      document as one block of text, so blank lines can be contained within
      the matched text.

      I tried removing "while (<>)" from the script, which resulted in my
      entire document being erased. I had the same problem when I tried
      writing a script from scratch, which is why I searched for and
      modified a working script from the forum.

      Can some Perl guru help me?

      Daniel T. Calmes

      Source: http://groups.yahoo.com/group/ntb-clips/message/9979
      --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@c...>
      > Hi Alan,
      > Cool stuff, your Perl case changer! Your patterns also work fine in
      > my Perl Regexp dialog. I had read about .*? before, but forgot
      > it.
      > One enhancement would be to treat the newlines as dot characters by
      > using an "s" modifier together with either the paragraph or whole
      > file unit. That way the opening tag, text and closing tag don't
      > to be on the same line for it to work. When I get a chance I think
      > will add an option for the "s" modifier to my dialog. Below is your
      > perl script modified to operate on sections separated by blank
      > (what I call paragraphs).
      > Regards,
      > Sheri
      > H="_pl_case_changer"
      > #!perl
      > local $/="";
      > # Works entire doc if nothing is selected
      > # Or, works just your selection if text is selected
      > while (<>) { # ea section between blank lines
      > s/(<strong>)(.*?)(<\/strong>)/$1\U$2\E$3/gis;
      > print ;
      > } # end
    • Show all 5 messages in this topic