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

Find and replace problem

Expand Messages
  • n.samuel79
    Hi All, #my string is $sample= [3b2users] x-counters 7/2/2008 2:00:00 PM ; #find and replace
    Message 1 of 3 , Jul 2, 2008
      Hi All,

      #my string is
      $sample="<Mail><Subject>[3b2users]
      x-counters</Subject><Received>7/2/2008 2:00:00 PM</Received></Mail>";
      #find and replace
      $sample=~s#<Subject>[3b2users] x-counters</Subject><Received>7/2/2008
      2:00:00 PM</Received>##;
      #output
      print $sample;

      i am not getting the correct output. please help me out.
      #if i use like this i am able to get the value. i don't what to put
      the slash, what should i do????
      $sample=~s#<Subject>\[3b2users\]
      x-counters</Subject><Received>7/2/2008 2:00:00 PM</Received>##;

      Sam
    • VIJAY KUMAR
      Use Q and E before and after respectively in search string.   i.e.   $sample=~s# Q [3b2users] x-counters 7/2/2008 2:00:00
      Message 2 of 3 , Jul 2, 2008
        Use \Q and \E before and after respectively in search string.
         
        i.e.
         
        $sample=~s#\Q<Subject> [3b2users] x-counters</ Subject>< Received> 7/2/2008 2:00:00 PM</Received> \E##;


        --- On Wed, 2/7/08, n.samuel79 <n.samuel79@...> wrote:

        From: n.samuel79 <n.samuel79@...>
        Subject: [PBML] Find and replace problem
        To: perl-beginner@yahoogroups.com
        Date: Wednesday, 2 July, 2008, 3:02 PM






        Hi All,

        #my string is
        $sample="<Mail> <Subject> [3b2users]
        x-counters</ Subject>< Received> 7/2/2008 2:00:00 PM</Received> </Mail>";
        #find and replace
        $sample=~s#< Subject>[ 3b2users] x-counters</ Subject>< Received> 7/2/2008
        2:00:00 PM</Received> ##;
        #output
        print $sample;

        i am not getting the correct output. please help me out.
        #if i use like this i am able to get the value. i don't what to put
        the slash, what should i do????
        $sample=~s#< Subject>\ [3b2users\ ]
        x-counters</ Subject>< Received> 7/2/2008 2:00:00 PM</Received> ##;

        Sam
















        Save all your chat conversations. Find them online at http://in.messenger.yahoo.com/webmessengerpromo.php

        [Non-text portions of this message have been removed]
      • samuel
        Thanks its working fine. _____ From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] On Behalf Of VIJAY KUMAR Sent: Wednesday, July 02,
        Message 3 of 3 , Jul 2, 2008
          Thanks its working fine.



          _____

          From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com]
          On Behalf Of VIJAY KUMAR
          Sent: Wednesday, July 02, 2008 3:44 PM
          To: perl-beginner@yahoogroups.com
          Subject: Re: [PBML] Find and replace problem



          Use \Q and \E before and after respectively in search string.

          i.e.

          $sample=~s#\Q<Subject> [3b2users] x-counters</ Subject>< Received> 7/2/2008
          2:00:00 PM</Received> \E##;

          --- On Wed, 2/7/08, n.samuel79 <n.samuel79@yahoo.
          <mailto:n.samuel79%40yahoo.co.in> co.in> wrote:

          From: n.samuel79 <n.samuel79@yahoo. <mailto:n.samuel79%40yahoo.co.in> co.in>
          Subject: [PBML] Find and replace problem
          To: perl-beginner@ <mailto:perl-beginner%40yahoogroups.com> yahoogroups.com
          Date: Wednesday, 2 July, 2008, 3:02 PM

          Hi All,

          #my string is
          $sample="<Mail> <Subject> [3b2users]
          x-counters</ Subject>< Received> 7/2/2008 2:00:00 PM</Received> </Mail>";
          #find and replace
          $sample=~s#< Subject>[ 3b2users] x-counters</ Subject>< Received> 7/2/2008
          2:00:00 PM</Received> ##;
          #output
          print $sample;

          i am not getting the correct output. please help me out.
          #if i use like this i am able to get the value. i don't what to put
          the slash, what should i do????
          $sample=~s#< Subject>\ [3b2users\ ]
          x-counters</ Subject>< Received> 7/2/2008 2:00:00 PM</Received> ##;

          Sam

          Save all your chat conversations. Find them online at http://in.messenger
          <http://in.messenger.yahoo.com/webmessengerpromo.php>
          .yahoo.com/webmessengerpromo.php

          [Non-text portions of this message have been removed]





          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.