Procmail recipe using range of character classes
Category: Computers > Algorithms
Asked by: fmcneely-ga
List Price: $10.00
15 Jun 2002 19:45 PDT
Expires: 22 Jun 2002 19:45 PDT
Question ID: 27329
I'm trying to write a procmail recipe that sends email from a range of IP addresses to a certain email box. For example: :0 : * ^Received.*123\.123\.123\.123 somemailbox puts the any email who's received line contains 184.108.40.206 into the email box somemailbox. What if I wanted to put all email from IP number ranging from 220.127.116.11 to 18.104.22.168 into the same box. At first I thought this was the solution: * ^Received.*[123-223]\.[123-223]\.[123-223]\.[123-223] but it is not.
Re: Procmail recipe using range of character classes
Answered By: cjs2u-ga on 15 Jun 2002 20:11 PDT
Hi fmcneely, I think the characters inside [ ] brackets can only be single numbers to single numbers. For example, [0-9] would work but [10-11] would not. It works the same way with alphabetic characters. For example, to specify A through D you'd say [A-D]. But if you wanted something like AAA to AAB, you couldn't say [AAA-AAB]. What you are asking for requires breaking up the recipe. It will expand to a multi-line rule. :0: * ^Received.*12[3-9]\.12[3-9]\.12[3-9]\.12[3-9] * ^Received.*1[3-9][0-9]\.1[0-9][0-9]\.1[0-9][0-9]\.1[0-9][0-9] * ^Received.*2[0-1][0-9]\.2[0-1][0-9]\.2[0-1][0-9]\.2[0-1][0-9] * ^Received.*2[1-2][0-3]\.2[0-2][0-3]\.2[0-2][0-3]\.2[0-2][0-3] somemailbox I hope this works - just ask for Answer Clarification if it doesn't! I did that from my head, BUT, you can still check this sites for some additional hints: Some site hosting many UNIX man pages http://www.sunspot.noao.edu/cgi-bin-local/man-cgi?regexp+5 Google search terms: man regexp [ ] ://www.google.com/search?hl=en&lr=&q=man+regexp+%5B+%5D Sincerely, CJS
rated this answer:
This answer has helped me understand very clearly.
|There are no comments at this time.|
If you feel that you have found inappropriate content, please let us know by emailing us at email@example.com with the question ID listed above. Thank you.
|Search Google Answers for|