hi

thanks for the pointers. i think the news thing, or something, made the 
question a little unclear, as it stripped some characters from the input.
the input is the default way email headers are sent with the "from" and "to" 
portions,
"name" <[EMAIL PROTECTED]>
the question was pertaining to get 'name' out of "name" at the start, and 
the email address out of the <<>> brackets. however i managed to figure that 
one out by playing.
the other question i have involves searching a string. i'm a little 
unfamiliar with this process as well. i'm basically writing a script to 
automate the sending out of emails, and it checks the pop3 box every so 
often and sends out emails depending on what's sat in there, then deletes 
them. in this case it's paypal emails. messages paypal send to say i've 
received a payment. this needs to be expanded further than just picking 
particular words out of the entire subject line as this may not always be 
the case. say for example, the subject said:
item no.00001313131 - notification of an instant payment received  from 
ebay_user ([EMAIL PROTECTED])
i can if ($subject =~ /$item_number/) to pick out the item number from that, 
but i need to search for the email address and the username in the subject. 
i suppose the easiest way to do this would be to search the string for 
"(wildcard-here)" and take one off the index of that to find the username in 
question (as this is always going to change). is there any easy way to do 
this with regex or otherwise?

i hope this makes it a little clearer!

thanks, dan


""Dr.Ruud"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> "Dan" schreef:
>
>> if (substr($line,0,5) eq "From:")
>
> You don't even need to know that 'From:' is 5 characters, if you use
>
>  if ( 0 == index $line, 'From:' )
>
>
>> i wrote a program some months back which utilised a compelx regex sub
>>
>> $onchan{lc($data[0])} =~ s/(,|^)\Q$data[1]\E(?=,|$)//;
>>
>> which substitutes the exact match for $data[1] in a long string which
>> is csv, and replace it with nothing. i'm trying to use the same
>> routine, or the same method, to get the 'dan' out of
>> "dan" [EMAIL PROTECTED]
>> but a) the regex confuses me enough to not know how to get that out
>> of there (i've replaced the ,'s with "'s, but that's obviously not
>> enough), and b) i don't know how to give the regex the full line of
>> text, and assign the extracted value into a variable for use later on.
>
> Please give better examples of input and expected output. Use
> "example.com" in examples.
>
>
> This contains a regexp that will remove the non-@ characters from the
> start of a string:
>
>  echo '[EMAIL PROTECTED]' | perl -pe 's/[EMAIL PROTECTED]//'
>
> See also: perldoc -q strip
>
> -- 
> Affijn, Ruud
>
> "Gewoon is een tijger."
>
>
> 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to