Re: regex require a period

2003-10-11 Thread Daniel Staal
--On Friday, October 10, 2003 18:21 -0700 "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: So, would this be it for the optional? /^[a-zA-Z0-9][\w-]*\.[a-zA-z]+$/ thanks Yep. Though you can always try for yourself... Daniel T. Staal -

Re: regex require a period

2003-10-10 Thread perl
Great! Final verification question. Atleast for now :) Do I need to use delimiter for a hyphen? /^[a-zA-Z0-9][\w-]*\.[a-zA-z]+$/ or /^[a-zA-Z0-9][\w\-]*\.[a-zA-z]+$/ thanks > --On Friday, October 10, 2003 18:21 -0700 "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> wrote: > >> So, would this be it for

Re: regex require a period

2003-10-10 Thread Daniel Staal
--On Friday, October 10, 2003 18:21 -0700 "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: So, would this be it for the optional? /^[a-zA-Z0-9][\w-]*\.[a-zA-z]+$/ thanks Yep, that should work for you. Daniel T. Staal (By the way: Don't reply to me *and* the list. I've set up my email client s

Re: regex require a period

2003-10-10 Thread perl
So, would this be it for the optional? /^[a-zA-Z0-9][\w-]*\.[a-zA-z]+$/ thanks > --On Friday, October 10, 2003 17:45 -0700 "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> wrote: > >> start with [a-zA-Z0-9] >> chars following is [\w-] BUT IS OPTIONAL >> >> /^[a-zA-Z0-9][\w-]\.[a-zA-z]+$/ >> >> I think

Re: regex require a period

2003-10-10 Thread Daniel Staal
--On Friday, October 10, 2003 17:45 -0700 "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: start with [a-zA-Z0-9] chars following is [\w-] BUT IS OPTIONAL /^[a-zA-Z0-9][\w-]\.[a-zA-z]+$/ I think the regex is not doing the option \w part. Correct, it isn't. You haven't asked it to... To make it o

Re: regex require a period

2003-10-10 Thread perl
The regex below is working for after the period. The part in fron is not working. It is requiring atleast 2 chars before the period which is not my rule. the rule for the front part: start with [a-zA-Z0-9] chars following is [\w-] BUT IS OPTIONAL /^[a-zA-Z0-9][\w-]\.[a-zA-z]+$/ I think the regex

Re: regex require a period

2003-10-10 Thread perl
The regex below is working for after the period. The part in fron is not working. It is requiring atleast 2 chars before the period which is not my rule. the rule for the front part: start with [a-zA-Z0-9] chars following is [\w-] BUT IS OPTIONAL /^[a-zA-Z0-9][\w-]\.[a-zA-z]+$/ I think the regex

Re: regex require a period

2003-10-10 Thread Daniel Staal
--On Friday, October 10, 2003 16:43 -0700 "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: rules: starts with alphanumeric 3 chars long Note, so we are not confused: you mean _at least_ 3 chars long. (Not _only_ 3 chars long.) require ONLY one period require alpha after the period Ok, what exact

Re: regex require a period

2003-10-10 Thread perl
rules: starts with alphanumeric 3 chars long require ONLY one period require alpha after the period /^[a-zA-Z0-9][\w-].[a-zA-z]/ #but now working sub validate { local $_ = shift; return( length >= 3 and tr/.// == 1 and /^[[:alpha:]]/ and /[a-zA-Z0-9].[a-

Re: regex require a period

2003-10-10 Thread Steve Grazzini
On Fri, Oct 10, 2003 at 03:56:43PM -0700, [EMAIL PROTECTED] wrote: > Ok - I got it to work by changing the line to length >= 3 Good. > If I could push the rule a little further, a new rule added > is that an alpha char a-Z MUST be after the period. Well now you have four rules. Again, I think

Re: regex require a period

2003-10-10 Thread perl
Ok - I got it to work by changing the line to length >= 3 If I could push the rule a little further, a new rule added is that an alpha char a-Z MUST be after the period. thanks > On Fri, Oct 10, 2003 at 03:11:52PM -0700, [EMAIL PROTECTED] wrote: >> This is not working as I expected: >> >> if(v

Re: regex require a period

2003-10-10 Thread Steve Grazzini
On Fri, Oct 10, 2003 at 03:11:52PM -0700, [EMAIL PROTECTED] wrote: > This is not working as I expected: > > if(validate('abc.com')) > { print "true"; } > else > { print "false"; } It prints "false" (because the length is > 4). > > sub validate { > > local $_ = shift; > > return( length

Re: regex require a period

2003-10-10 Thread perl
> /^[a-zA-Z][\w\-\.]{3,}$/ && /\./ The above matches more than 1 period. I MUST have 1 and ONLY 1 period. Also, can I fit it on one line? this doesn't work either sub isValidDomain { return shift =~ /^[a-zA-Z0-9][\w\-\.]{3,}$/ } thanks --- > How about something like: > > /^[a-zA-Z][\w\-\.]

Re: regex require a period

2003-10-10 Thread perl
This is not working as I expected: if(validate('abc.com')) { print "true"; } else { print "false"; } -rkl > On Fri, Oct 10, 2003 at 12:49:51AM -0700, [EMAIL PROTECTED] wrote: >> I couldn't get it to work. > > Whoops --> > > sub validate { > local $_ = shift; > return( length == 4 and >

Re: regex require a period

2003-10-10 Thread Steve Grazzini
On Fri, Oct 10, 2003 at 12:49:51AM -0700, [EMAIL PROTECTED] wrote: > I couldn't get it to work. Whoops --> sub validate { local $_ = shift; return( length == 4 and tr/.// == 1 and /^[[:alpha:]]/ ) } -- Steve -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: regex require a period

2003-10-10 Thread perl
I couldn't get it to work. Will the sub run as is? Is the :alpha: suppose to be there or replace it? > On Thu, Oct 09, 2003 at 11:58:31PM -0700, [EMAIL PROTECTED] wrote: >> here's the rules: >> starts with alphanumeric >> 4 chars long >> require one period >> >> /^[a-zA-Z][\w\-\.]{3,}$/ > > I wou

Re: regex require a period

2003-10-10 Thread perl
> /^[a-zA-Z][\w\-\.]{3,}$/ && /\./ Matches more than 1 period. I MUST have 1 and ONLY 1 period. Also, can I fit it on one line? I couldn't doit. sub isValidDomain { return shift =~ /^[a-zA-Z0-9][\w\-\.]{3,}$/ } --- > How about something like: > > /^[a-zA-Z][\w\-\.]{3,}$/ && /\./ > > On Fri, 200

Re: regex require a period

2003-10-10 Thread Steve Grazzini
On Thu, Oct 09, 2003 at 11:58:31PM -0700, [EMAIL PROTECTED] wrote: > here's the rules: > starts with alphanumeric > 4 chars long > require one period > > /^[a-zA-Z][\w\-\.]{3,}$/ I wouldn't try to do it with one regex. You can probably come up with one, but the next time you have to read this co

Re: regex require a period

2003-10-10 Thread simran
How about something like: /^[a-zA-Z][\w\-\.]{3,}$/ && /\./ On Fri, 2003-10-10 at 16:58, [EMAIL PROTECTED] wrote: > here's the rules: > starts with alphanumeric > 4 chars long > require one period > > /^[a-zA-Z][\w\-\.]{3,}$/ > > I think my regex is not doing the required period. > > thanks, >