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

Re: [PBML] REGEX - Please de-confuse me please

Expand Messages
  • Gordon Stewart
    At 04:43 AM 7/2/03 Jeff japhy Pinyan wrote:- ... Is anyone online ? ive got (text of my log file) :- Subject 1: Good MOrning mummy - [NZ] Subject 2:
    Message 1 of 6 , Jul 2, 2003
    • 0 Attachment
      At 04:43 AM 7/2/03 Jeff 'japhy' Pinyan wrote:-

      >On Jul 2, Gordon Stewart said:
      > >if ($subj !~ m/$subject/i){
      >This checks to see if $subject (as a regex) can be found
      >case-insensitively in $subj. Is this what you are trying to do? Please
      >be more clear.

      Is anyone online ?

      ive got (text of my log file) :-

      Subject 1: ' Good MOrning mummy' - '[NZ]'

      Subject 2: ' Good MOrning mummy' - '[NZ]'

      That is in my log file -

      the [NZ] thing is $subj
      the Good MOrning mummy is $subject

      Now - as $subject does NOT contain [NZ]
      I want $subject to CHANGE to " [NZ] Good MOrning mummy " (no quotes)

      As the regex you quoted above DOES NOT work, Ive changed it to :-

      print "Subject 1: '$subject' - '$subj'\n\n";

      if ($subject !~ m/$subj/i){
      print "TEST 2 - $subj NOT included in $subject\n";

      $subject =~ s/^ +//;
      print "Subject 1A: '$subject' - '$subj'\n\n";
      $subject = "$subj $subject";
      print "Subject 1B: '$subject' - '$subj'\n\n";

      print "Subject 2: '$subject' - '$subj'\n\n";

      It clearly displays the two "Subject" prints - however does NOT print the
      'test' fields..

      Today, Ive tested it (at work - a few emails) & it puts '[NZ]' multiple
      times - one extra each time I reply to the message :-

      RULES :-

      1) If it doesnt containt "[NZ]" - add it to the front of the subject
      2) if it contains "[NZ]" - do nothing..

      pretty simple - & ive been doing regexes for a while
      However im totally bamboozled as to why this simple regex doesnt do what I

      <getting a "little" fustrated >


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