wolfger has asked for the wisdom of the Perl Monks concerning the following question:
I whipped up a quick regex today to satisfy a range of possible domain names, and while it matches everything I want, it also matches a few things I don't want. Easy enough to error-proof with an "if", but I'm wondering if there's a way to wrap this all up in one regex. Here's what I have:
abc[123]\.xy[z1]1?\.nota\.urlThe only problem is in the xyz11? part of the expression. I want to match xyz, xy1, and xyz1, but not xy11, and I couldn't figure out how to limit that.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: wanting a more explicit regex
by moritz (Cardinal) on Feb 12, 2008 at 13:47 UTC | |
by wolfger (Deacon) on Feb 12, 2008 at 16:17 UTC | |
Re: wanting a more explicit regex
by poolpi (Hermit) on Feb 12, 2008 at 14:12 UTC | |
Re: wanting a more explicit regex
by Anonymous Monk on Feb 12, 2008 at 14:21 UTC |
Back to
Seekers of Perl Wisdom