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

Regex for selecting non alphas ?

Expand Messages
  • Gordon Stewart
    --=======13E8382D======= Content-Type: text/plain; x-avg-checked=avg-ok-536A3173; charset=us-ascii; format=flowed Content-Transfer-Encoding: 8bit my text I
    Message 1 of 3 , Aug 5, 2003
      --=======13E8382D=======
      Content-Type: text/plain; x-avg-checked=avg-ok-536A3173;
      charset=us-ascii; format=flowed
      Content-Transfer-Encoding: 8bit


      my text I wanna keep....

      --=======13E8382D=======--

      See above - Has anyone got a regex to select the text & remove the
      content-type thing ?

      I'm trying :-
      if ($line =~ m/\-\-\=+[\d+:\w]\=+/i){

      to pick it up etc.. - However it doesnt work...

      Is there a type of regex to to remove the computer codes to tell you what
      email is ?

      G
    • Damien Carbery
      ... you what ... The colon is breaking this. Also, w is case insensitive alphanumeric ([a-zA-Z_0-9]) so you don t need the d+ or the /i . [I found this
      Message 2 of 3 , Aug 5, 2003
        --- In perl-beginner@yahoogroups.com, Gordon Stewart <gordon52@s...>
        wrote:
        >
        >
        > --=======13E8382D=======
        > Content-Type: text/plain; x-avg-checked=avg-ok-536A3173;
        > charset=us-ascii; format=flowed
        > Content-Transfer-Encoding: 8bit
        >
        >
        > my text I wanna keep....
        >
        > --=======13E8382D=======--
        >
        > See above - Has anyone got a regex to select the text & remove the
        > content-type thing ?
        >
        > I'm trying :-
        > if ($line =~ m/\-\-\=+[\d+:\w]\=+/i){
        >
        > to pick it up etc.. - However it doesnt work...
        >
        > Is there a type of regex to to remove the computer codes to tell
        you what
        > email is ?
        >
        > G

        > if ($line =~ m/\-\-\=+[\d+:\w]\=+/i){
        The colon is breaking this.
        Also, '\w' is case insensitive alphanumeric ([a-zA-Z_0-9]) so you
        don't need the '\d+' or the '/i'.
        [I found this with a quick look up my 'Perl in a Nutshell' book - do
        you have any reference text?]

        If parsing the text line by line you could look for the start line (ie
        --===blah===--), then search for a blank line (because I believe the
        header stuff is followed by one (similar to after 'Content-Type' when
        generating HTML in CGI), then print out all the text until you get the
        end line (which will be identical to the start line).
        Make sense?
      • Gordon Stewart
        ... yep :- ive got :- if (($p ==1)&&(!$line =~ m/ w/i)){ $p=50; } if ($line =~ m/ - - =+ w+ =+/i){ $p++; } $message= $message n $line if ($p==50); This seems
        Message 3 of 3 , Aug 5, 2003
          At 01:47 PM 8/5/03 +0000, you wrote:

          > > if ($line =~ m/\-\-\=+[\d+:\w]\=+/i){
          >The colon is breaking this.
          >Also, '\w' is case insensitive alphanumeric ([a-zA-Z_0-9]) so you
          >don't need the '\d+' or the '/i'.
          >[I found this with a quick look up my 'Perl in a Nutshell' book - do
          >you have any reference text?]
          >
          >If parsing the text line by line you could look for the start line (ie
          >--===blah===--), then search for a blank line (because I believe the
          >header stuff is followed by one (similar to after 'Content-Type' when
          >generating HTML in CGI), then print out all the text until you get the
          >end line (which will be identical to the start line).
          >Make sense?

          yep :-

          ive got :-

          if (($p ==1)&&(!$line =~ m/\w/i)){
          $p=50;
          }
          if ($line =~ m/\-\-\=+\w+\=+/i){
          $p++;
          }

          $message="$message\n>$line" if ($p==50);


          This seems to work...

          Only makes $p=1 when it matches the 1st one,
          Then if its already selected - waits until a blank line is reached..
          & then when it reaches a blank line - ads the text to the message ;)

          (until the next --==== line etc... is rerached ($p is now 51 ) ;)

          Seems to work...

          (ive also got a subroutine if there isnt any --=== etc in it..)

          G



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