Re: How to do a regexp
On Sat, Feb 24, 2001 at 12:15:25PM -0500, Rich Lafferty wrote: On Sat, Feb 24, 2001 at 08:21:28AM -0500, Josh Huber ([EMAIL PROTECTED]) wrote: * ^TO_about.com the TO_ is expanded to a nice regex which matches the proper text before an address. Everyone keeps saying this, and it still doesn't work. That nice regex doesn't match the text *in* an address. Like the @ sign, for instance. ok, you're right. it should be * ^TO_.*about\.com ttyl, -- Josh Huber | [EMAIL PROTECTED] | PGP signature
Re: How to do a regexp
Bruce A. Petro wrote (about a procmail condition): I understand the leading .* based on your remark, but what about the trailing .* ?? You can safely omit it. It doesn't make any difference whatsoever with regard to matching. /HW
Re: How to do a regexp
On Wed, Feb 21, 2001 at 04:21:30PM -0500, Josh Huber wrote: The reasoning behind this is: * ^To: .*about.com.* ...often addresses are formatted in a way like: John Doe [EMAIL PROTECTED] or [EMAIL PROTECTED] (John Doe) but are not that often just the email address alone. The above is, as someone else pointed out, obviously wrong. I wasn't thinking :) You don't need to match the .* at the end because the pattern doesn't need to match up to the end of the To line -- it will just match as much as you've specified, and only fail if something doesn't match. sorry about that... So, to summarize, something like this would be good: * ^To: .*about.com would work, but if you want to more careful...something like the following would be better: * ^TO_about.com the TO_ is expanded to a nice regex which matches the proper text before an address. man procmailrc and search for TO_. ttyl, -- Josh Huber | [EMAIL PROTECTED] | PGP signature
Re: How to do a regexp
On Sat, Feb 24, 2001 at 08:21:28AM -0500, Josh Huber ([EMAIL PROTECTED]) wrote: * ^TO_about.com the TO_ is expanded to a nice regex which matches the proper text before an address. Everyone keeps saying this, and it still doesn't work. That nice regex doesn't match the text *in* an address. Like the @ sign, for instance. -Rich -- -- Rich Lafferty --- Sysadmin/Programmer, Instructional and Information Technology Services Concordia University, Montreal, QC (514) 848-7625 - [EMAIL PROTECTED] --
Re: How to do a regexp
On Thu, Feb 22, 2001 at 10:00:51PM -0500, Joe Philipps wrote: : On Mon, Feb 19, 2001 at 06:21:58PM -0500, Bruce A. Petro wrote: : : Can you point me to some book or doc or man that says things in fairly : plain english as you did??? I'm finding a lot of docs on regexps that : are hard to translate when you are just starting out like me. : : "man 5 regexp" on HP-UX : "man grep" or "man ed" on almost all systems : The info. in info on a GNU system (e.g., GNU/Linux) is usually : helpful, or failing that, the info within GNUEmacs (providing the info : documentation for it was installed/kept on your system). By default, : Ctrl-H i gets you into GNUEmacs info mode once in the editor itself. There's a book on the VI editor by O'Reilly and Associations that has a nice section on regular expressions, with explanations and examples that are pretty novice-friendly as I've seen. -- Eugene Lee [EMAIL PROTECTED]
Re: How to do a regexp
On Mon, Feb 19, 2001 at 06:21:58PM -0500, Bruce A. Petro wrote: Can you point me to some book or doc or man that says things in fairly plain english as you did??? I'm finding a lot of docs on regexps that are hard to translate when you are just starting out like me. "man 5 regexp" on HP-UX "man grep" or "man ed" on almost all systems The info. in info on a GNU system (e.g., GNU/Linux) is usually helpful, or failing that, the info within GNUEmacs (providing the info documentation for it was installed/kept on your system). By default, Ctrl-H i gets you into GNUEmacs info mode once in the editor itself. -- Oo---o, Oo---o, O-weem-oh-wum-ooo-ayyy In the jungle, the silicon jungle, the process sleeps tonight. Joe Philipps [EMAIL PROTECTED], http://www.philippsfamily.org/Joe/ public PGP/GPG key 0xFA029353 available via http://www.keyserver.net On Mon, Feb 19, 2001 at 06:21:58PM -0500, Bruce A. Petro wrote: Many thanks! Can you point me to some book or doc or man that says things in fairly plain english as you did??? I'm finding a lot of docs on regexps that are hard to translate when you are just starting out like me. They don't seem to say things like: The "." means "any character", so ".*" means "any string of characters". Also, question: I understand the leading .* based on your remark, but what about the trailing .* ?? The TO address should always end with t the ".com" - is there a need for it, or were you just being ultra cautious to get everything possible? THANKS AGAIN! Bruce. On Sat, Feb 17 03:58AM, Nollaig MacKenzie wrote: On 2001.02.16 23:23:57, you, the extraordinary Bruce A. Petro, opined: Hi - I'm new at regexp's and don't know how to do this... The main question is from procmail regexp I did that is not working. I want it to find all mail where the TO: contains "@about.com" ("[EMAIL PROTECTED], [EMAIL PROTECTED]). Any suggestions why its not working? :0: * ^[EMAIL PROTECTED] about.com Try: :0: * ^To: .*about.com.* about.com The "." means "any character", so ".*" means "any string of characters". Cheers, N. -- Nollaig MacKenzie [EMAIL PROTECTED] http://www.amhuinnsuidhe.cx Oppose renaming Mt Logan!! http://www.savemtlogan.com -- Oo---o, Oo---o, O-weem-oh-wum-ooo-ayyy In the jungle, the silicon jungle, the process sleeps tonight. Joe Philipps [EMAIL PROTECTED], http://www.philippsfamily.org/Joe/ public PGP/GPG key 0xFA029353 available via http://www.keyserver.net PGP signature
Re: How to do a regexp
On Mon, Feb 19, 2001 at 06:21:58PM -0500, Bruce A. Petro wrote: Many thanks! Can you point me to some book or doc or man that says things in fairly plain english as you did??? I'm finding a lot of docs on regexps that are hard to translate when you are just starting out like me. They don't seem to say things like: The "." means "any character", so ".*" means "any string of characters". Personally, I'd recommend the O'Reilly book, "Mastering Regular Expressions". If you don't want to buy that book, find someone who's got the "Programming Perl" book, and read the section on Regular Expressions. (warning: perl does have some nice extentions to the standard regex syntax) Also, question: I understand the leading .* based on your remark, but what about the trailing .* ?? The TO address should always end with t the ".com" - is there a need for it, or were you just being ultra cautious to get everything possible? The reasoning behind this is: * ^To: .*about.com.* ...often addresses are formatted in a way like: John Doe [EMAIL PROTECTED] or [EMAIL PROTECTED] (John Doe) but are not that often just the email address alone. Hope that helps, -- Josh Huber | [EMAIL PROTECTED] | PGP signature
Re: How to do a regexp
Many thanks! Can you point me to some book or doc or man that says things in fairly plain english as you did??? I'm finding a lot of docs on regexps that are hard to translate when you are just starting out like me. They don't seem to say things like: The "." means "any character", so ".*" means "any string of characters". Also, question: I understand the leading .* based on your remark, but what about the trailing .* ?? The TO address should always end with t the ".com" - is there a need for it, or were you just being ultra cautious to get everything possible? THANKS AGAIN! Bruce. On Sat, Feb 17 03:58AM, Nollaig MacKenzie wrote: On 2001.02.16 23:23:57, you, the extraordinary Bruce A. Petro, opined: Hi - I'm new at regexp's and don't know how to do this... The main question is from procmail regexp I did that is not working. I want it to find all mail where the TO: contains "@about.com" ("[EMAIL PROTECTED], [EMAIL PROTECTED]). Any suggestions why its not working? :0: * ^[EMAIL PROTECTED] about.com Try: :0: * ^To: .*about.com.* about.com The "." means "any character", so ".*" means "any string of characters". Cheers, N. -- Nollaig MacKenzie [EMAIL PROTECTED] http://www.amhuinnsuidhe.cx Oppose renaming Mt Logan!! http://www.savemtlogan.com
Re: How to do a regexp
On Sun, Feb 18, 2001 at 12:32:32AM -0600 or thereabouts, Aaron Schrab wrote: At 19:38 -0600 17 Feb 2001, Gary [EMAIL PROTECTED] wrote: On Sat, Feb 17, 2001 at 10:56:03AM -0600, Gary wrote: :O: * (^(To|Cc):*@about.com*) about.com can think of a few more ways too. The above has worked for me well over the years. I can't see how that could possibly work. It doesn't allow anything other than colons (:) between the header name and the at-sign (@). The asterisk (*) at the end is also wrong since you want to match exactly one "m" there, not zero or more. You may not see it Aaron, but I can assure you it has worked for 10s of 1000s of messages for me. Of course, Bruce's real problem was having ABOUT.COM in caps to begin with. as you know, UNIX/Linux is case sensitive. Check Just because Unix filesystems are case sensitive doesn't mean that everything else is. In particular, regex conditions in procmail are not case sensitive unless the "D" flag is used on the recipe. You are correct, I had forgotten since not having to play with my procmail in so long. -- Best regards, Gary
Re: How to do a regexp
On Sat, Feb 17, 2001 at 10:56:03AM -0600, Gary wrote: On Fri, Feb 16, 2001 at 11:23:57PM -0500 or thereabouts, Bruce A. Petro wrote: Hi - I'm new at regexp's and don't know how to do this... :0: * ^[EMAIL PROTECTED] about.com In Procmail, these are called recipes. Try this, which will take care of *about.com either as TO or Cc. :O: * (^(To|Cc):*@about.com*) about.com Wouldn't ":*" mean "zero or more occurrences of ':'"? Wouldn't ":.*" or ":[^@]*" be more appropriate? I don't think the outer parentheses are necessary, but I guess that depends on what you're trying to accomplish. I'd nix 'em so your computer has less work to do. -- Oo---o, Oo---o, O-weem-oh-wum-ooo-ayyy In the jungle, the silicon jungle, the process sleeps tonight. Joe Philipps [EMAIL PROTECTED], http://www.philippsfamily.org/Joe/ public PGP/GPG key 0xFA029353 available via http://www.keyserver.net PGP signature
Re: How to do a regexp
On Sat, Feb 17, 2001 at 05:05:22PM -0500 or thereabouts, Joe Philipps wrote: On Sat, Feb 17, 2001 at 10:56:03AM -0600, Gary wrote: On Fri, Feb 16, 2001 at 11:23:57PM -0500 or thereabouts, Bruce A. Petro wrote: :0: * ^[EMAIL PROTECTED] about.com In Procmail, these are called recipes. Try this, which will take care of *about.com either as TO or Cc. :O: * (^(To|Cc):*@about.com*) about.com Of course, it would probably work I am sure. That is the beauty of regex as there are several ways to write it and accomplish the same thing. I can think of a few more ways too. The above has worked for me well over the years. Of course, Bruce's real problem was having ABOUT.COM in caps to begin with. as you know, UNIX/Linux is case sensitive. Check www.procmail.org for many samples and tricks. Wouldn't ":*" mean "zero or more occurrences of ':'"? Wouldn't ":.*" or ":[^@]*" be more appropriate? I don't think the outer parentheses are necessary, but I guess that depends on what you're trying to accomplish. I'd nix 'em so your computer has less work to do. -- Best regards, Gary Today's thought: Before you criticize someone walk a mile in his shoes. That way if he gets angry he'll be a mile away -- and barefoot.
Re: How to do a regexp
At 19:38 -0600 17 Feb 2001, Gary [EMAIL PROTECTED] wrote: On Sat, Feb 17, 2001 at 10:56:03AM -0600, Gary wrote: :O: * (^(To|Cc):*@about.com*) about.com can think of a few more ways too. The above has worked for me well over the years. I can't see how that could possibly work. It doesn't allow anything other than colons (:) between the header name and the at-sign (@). The asterisk (*) at the end is also wrong since you want to match exactly one "m" there, not zero or more. Of course, Bruce's real problem was having ABOUT.COM in caps to begin with. as you know, UNIX/Linux is case sensitive. Check Just because Unix filesystems are case sensitive doesn't mean that everything else is. In particular, regex conditions in procmail are not case sensitive unless the "D" flag is used on the recipe. -- Aaron Schrab [EMAIL PROTECTED] http://www.execpc.com/~aarons/ A debugged program is one for which you have not yet found the conditions that make it fail. -- Jerry Ogdin
How to do a regexp
Hi - I'm new at regexp's and don't know how to do this... The main question is from procmail regexp I did that is not working. I want it to find all mail where the TO: contains "@about.com" ("[EMAIL PROTECTED], [EMAIL PROTECTED]). Any suggestions why its not working? :0: * ^[EMAIL PROTECTED] about.com If anyone can help - I'd really appreciate it! Thanks, Bruce.