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

Re: 3/1/01 - Need simple (hopefully) code

Expand Messages
  • Damien Carbery
    How about (off the top of my head): s/ (.*?) /s/ $2 /; (should all be on one line). You may have to
    Message 1 of 2 , Mar 1, 2001
    • 0 Attachment
      How about (off the top of my head):
      s/<#FIELD NAME = (.*?)>(.*?)<\/#FIELD>/s/<#FIELD NAME = $1>$2<\/#FIELD
      $1>/;
      (should all be on one line). You may have to escape the '#' character,
      I don't know the regexp special chars off.
      Charles can probably suggest a better, shorter one.

      --- In perl-beginner@y..., "Gorden-Ozgul, Patricia E" <gorden@b...>
      wrote:
      > If you have helped me recently, thank you. Each reply has helped me
      in some
      > way.
      >
      > In any case, I need a quick/short solution. (like tonight if I can
      get it).
      >
      > I have data..
      > <#FIELD NAME = AAA>this is its value</#FIELD>
      > <#FIELD NAME = BBB>this is its value</#FIELD>
      > ...
      > ...
      >
      > I want to go through the entire file and replace the end tag with
      the
      > specific tag name embedded somewhere in it.
      > For example, this is what I need:
      >
      > <#FIELD NAME = AAA>this is its value</#FIELD AAA>
      > <#FIELD NAME = BBB>this is its value</#FIELD BBB>
      > ...
      > ...
      >
      > Something like storing the string from after the equal sign (=) up
      to the
      > right caret (>) of the beginning tag to a variable and
      > inserting the contents of that variable immediately preceeding the
      right
      > caret (>) of the end tag.
      >
      > ...For each record.
      >
      > If anyone has a clue, please pass it along.
      >
      > Thank you.
      > Pat
      >
      >
      >
      > __________________________________________________
      > Pat Gorden-Ozgul BNL-ISD Systems
      > gorden@b... 631-344-5159
    Your message has been successfully submitted and would be delivered to recipients shortly.