![]() |
RegExp for matching word "karl@aol.com" or word "paul@hotmail.com" ?
Just a stupid question from a newbie:
How do I setup a reg exp which matches if the text (line) contains either the full word "karl@aol.com" or the full word "paul@hotmail.com" (without quotes)? (karl@aol.com|paul@hotmail.com) does not work. Gerd |
Re: RegExp for matching word "karl@aol.com" or word "paul@hotmail.com"?
Gerd Pohlmann wrote:
> Just a stupid question from a newbie: > How do I setup a reg exp which matches if the text (line) contains > either the full word "karl@aol.com" or the full word > "paul@hotmail.com" (without quotes)? > > (karl@aol.com|paul@hotmail.com) > > does not work. Does not work? Please post a small but complete program, where you have included "use strict;" and "use warnings;" at the top, and that illustrates your problem. Let us know which error or warning messages you get (if any), and try to avoid just saying "does not work". -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl |
Re: RegExp for matching word "karl@aol.com" or word "paul@hotmail.com" ?
Gerd Pohlmann <gpohl@email.com> wrote:
> (karl@aol.com|paul@hotmail.com) > > does not work. Of course not, it is not Perl code. Did you mean to ask a question about Perl code? If so, then show us the Perl code that your question is about... -- Tad McClellan SGML consulting tadmc@augustmail.com Perl programming Fort Worth, Texas |
Re: RegExp for matching word "karl@aol.com" or word "paul@hotmail.com" ?
Am Wed, 04 Feb 2004 13:47:49 +0100 schrieb Gerd Pohlmann:
> Just a stupid question from a newbie: > How do I setup a reg exp which matches if the text (line) contains > either the full word "karl@aol.com" or the full word "paul@hotmail.com" (without quotes)? > > (karl@aol.com|paul@hotmail.com) > > does not work. > > Gerd Hi Gerd, you have to mask the @ and the . with a \ So it looks like this (karl\@aol\.com|paul\@hotmail\.com) If you want to use it in a Perl Program then you must includ it into two / like this (/karl\@aol\.com/|/paul\@hotmail\.com/) If you want to learn more about Regexp then use ISBN 3-89721-349-4 from O'Reilly. greets Robert -- There are only 10 types of people in the world: Those who understand binary, and those who don't. http://www.one-m.de http://www.lugbz.org/documents/smart-questions_de.html |
Re: RegExp for matching word "karl@aol.com" or word "paul@hotmail.com" ?
In <pan.2004.02.04.16.39.16.196934@lnubb.qr> Robert Meyer <rtbvfg99@lnubb.qr> writes:
>(/karl\@aol\.com/|/paul\@hotmail\.com/) That looks like a bitwise OR of two scalars... I suppose it would work, but it's not terribly good Perl. How about /karl\@aol\.com|paul\@hotmail\.com/ ? |
Re: RegExp for matching word "karl@aol.com" or word "paul@hotmail.com"?
J Krugman wrote:
> Robert Meyer writes: >> >> (/karl\@aol\.com/|/paul\@hotmail\.com/) > > That looks like a bitwise OR of two scalars... I suppose it would > work, but it's not terribly good Perl. How about > > /karl\@aol\.com|paul\@hotmail\.com/ > > ? Yeah, but since the email addresses are plain strings, it would probably be even better Perl to make use of the index() function instead of a regular expression. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl |
| All times are GMT. The time now is 06:17 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.