473,714 Members | 2,623 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

regexp validator - wrong?

ASP.NET app using c# and framework version 1.1.4322.573 on a IIS 6.0 web server.

A single-line asp:textbox control and regexp validator attached to it.

^\d+$ expression does match an empty string (when you don't enter any values) - this is wrong
d+ expression does not match, for example "g24" string - this is also wrong

www.regexplib.com test validator works fine for both cases, i.e. it is reporting "not match" for the first one and "match" for the second one. I am suspecting using different framework version from regexplib, and this being the source of the error. Do you have any other ideas?

--
Dmitry Korolyov [d_**@removethis part.mail.ru]
MVP: Windows Server - Active Directory
Nov 17 '05 #1
8 2026
Per MSDN on the RegularExpressi onValidatorCont rol:

"Note: Validation succeeds if the input control is empty. If a value is
required for the associated input control, use a RequiredFieldVa lidator
control in addition to the RegularExpressi onValidator control."

This is why it appears ^\d+$ is matched with an empty string.

Also, "d+" means match one or more "d" characters, which is why it does not
match "g24". You probably intended "^\w+$", meaning a single line string
with only alphanumerics [a-zA-Z_0-9].

-Steve Jansen

---------------------------
"Dmitry Korolyov" <d_**@removethi spart.mail.ru> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
ASP.NET app using c# and framework version 1.1.4322.573 on a IIS 6.0 web
server.

A single-line asp:textbox control and regexp validator attached to it.

^\d+$ expression does match an empty string (when you don't enter any
values) - this is wrong
d+ expression does not match, for example "g24" string - this is
also wrong

www.regexplib.com test validator works fine for both cases, i.e. it is
reporting "not match" for the first one and "match" for the second one. I am
suspecting using different framework version from regexplib, and this being
the source of the error. Do you have any other ideas?

--
Dmitry Korolyov [d_**@removethis part.mail.ru]
MVP: Windows Server - Active Directory
Nov 17 '05 #2
Thanks Steve.

1) Why the first example works the opposite (to what I see and what you have explained) at www.regexplib.com ? They have set up a testing area where you can test various regexps and see if they match or not the strings you enter.

2) \d+ means one or more digits. They can be anywhere within the string. This means "g2323" should match the regular expression, but it doesn't (although it does on the testing area of www.regexplib.com and in any other regexp-compatible language). Note that if I wanted a string which contains digits only, I'd use ^\d+$ regexp.

So I guess there should be some more ideas...

P.S. I'm still thinking of the different versions of the framework.

--
Dmitry Korolyov [d_**@removethis part.mail.ru]
MVP: Windows Server - Active Directory
"Steve Jansen" <st*****@dev.nu l> wrote in message news:uv******** ******@TK2MSFTN GP10.phx.gbl...
Per MSDN on the RegularExpressi onValidatorCont rol:

"Note: Validation succeeds if the input control is empty. If a value is
required for the associated input control, use a RequiredFieldVa lidator
control in addition to the RegularExpressi onValidator control."

This is why it appears ^\d+$ is matched with an empty string.

Also, "d+" means match one or more "d" characters, which is why it does not
match "g24". You probably intended "^\w+$", meaning a single line string
with only alphanumerics [a-zA-Z_0-9].

-Steve Jansen

---------------------------
"Dmitry Korolyov" <d_**@removethi spart.mail.ru> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
ASP.NET app using c# and framework version 1.1.4322.573 on a IIS 6.0 web
server.

A single-line asp:textbox control and regexp validator attached to it.

^\d+$ expression does match an empty string (when you don't enter any
values) - this is wrong
d+ expression does not match, for example "g24" string - this is
also wrong

www.regexplib.com test validator works fine for both cases, i.e. it is
reporting "not match" for the first one and "match" for the second one. I am
suspecting using different framework version from regexplib, and this being
the source of the error. Do you have any other ideas?

--
Dmitry Korolyov [d_**@removethis part.mail.ru]
MVP: Windows Server - Active Directory
Nov 17 '05 #3
Obviously I made a typo in the initial message, there should be \d+ instead of just d+

--
Dmitry Korolyov [d_**@removethis part.mail.ru]
MVP: Windows Server - Active Directory
"Steve Jansen" <st*****@dev.nu l> wrote in message news:uv******** ******@TK2MSFTN GP10.phx.gbl...
Per MSDN on the RegularExpressi onValidatorCont rol:

"Note: Validation succeeds if the input control is empty. If a value is
required for the associated input control, use a RequiredFieldVa lidator
control in addition to the RegularExpressi onValidator control."

This is why it appears ^\d+$ is matched with an empty string.

Also, "d+" means match one or more "d" characters, which is why it does not
match "g24". You probably intended "^\w+$", meaning a single line string
with only alphanumerics [a-zA-Z_0-9].

-Steve Jansen

---------------------------
"Dmitry Korolyov" <d_**@removethi spart.mail.ru> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
ASP.NET app using c# and framework version 1.1.4322.573 on a IIS 6.0 web
server.

A single-line asp:textbox control and regexp validator attached to it.

^\d+$ expression does match an empty string (when you don't enter any
values) - this is wrong
d+ expression does not match, for example "g24" string - this is
also wrong

www.regexplib.com test validator works fine for both cases, i.e. it is
reporting "not match" for the first one and "match" for the second one. I am
suspecting using different framework version from regexplib, and this being
the source of the error. Do you have any other ideas?

--
Dmitry Korolyov [d_**@removethis part.mail.ru]
MVP: Windows Server - Active Directory
Nov 17 '05 #4
1) .NET defines what it means for the regular expression validator to fire. And it ignores the empty string. The documentation says so - and it says to use a required field validator in addition, if your requirements are that the field be filled in.

How others chose to implement their regular expression validator is irrelevant.

2) '\d+' means that the entire string is just one or more digits. Not that there exists a substring of the original string with one or more digits.

The link you keep referring to, seems to see if there is a substring that matches.

For example, I put in '\d' for the expression, and 'asdf2sdf' for the test string.

Now, in reality, '\d' should only match a 1 character string that contains a digit. However, my string matched!

I disagree that this is actually a regular expression match for the string. There is a substring of my string that matches - but not the entire thing. In fact, absolutely anything will match, as long as there is at least one digit somewhere in it.

So the result from this web site is very misleading, and as far as I am concerned incorrect. If I am validating that someone enters a 5 digit zip code, but something 'a string 12345' is allowed to match - well, that's just plain wrong!
"Dmitry Korolyov [MVP]" <d_**@removethi spart.mail.ru> wrote in message news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Thanks Steve.

1) Why the first example works the opposite (to what I see and what you have explained) at www.regexplib.com ? They have set up a testing area where you can test various regexps and see if they match or not the strings you enter.

2) \d+ means one or more digits. They can be anywhere within the string. This means "g2323" should match the regular expression, but it doesn't (although it does on the testing area of www.regexplib.com and in any other regexp-compatible language). Note that if I wanted a string which contains digits only, I'd use ^\d+$ regexp.

So I guess there should be some more ideas...

P.S. I'm still thinking of the different versions of the framework.

--
Dmitry Korolyov [d_**@removethis part.mail.ru]
MVP: Windows Server - Active Directory
"Steve Jansen" <st*****@dev.nu l> wrote in message news:uv******** ******@TK2MSFTN GP10.phx.gbl...
Per MSDN on the RegularExpressi onValidatorCont rol:

"Note: Validation succeeds if the input control is empty. If a value is
required for the associated input control, use a RequiredFieldVa lidator
control in addition to the RegularExpressi onValidator control."

This is why it appears ^\d+$ is matched with an empty string.

Also, "d+" means match one or more "d" characters, which is why it does not
match "g24". You probably intended "^\w+$", meaning a single line string
with only alphanumerics [a-zA-Z_0-9].

-Steve Jansen

---------------------------
"Dmitry Korolyov" <d_**@removethi spart.mail.ru> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
ASP.NET app using c# and framework version 1.1.4322.573 on a IIS 6.0 web
server.

A single-line asp:textbox control and regexp validator attached to it.

^\d+$ expression does match an empty string (when you don't enter any
values) - this is wrong
d+ expression does not match, for example "g24" string - this is
also wrong

www.regexplib.com test validator works fine for both cases, i.e. it is
reporting "not match" for the first one and "match" for the second one. I am
suspecting using different framework version from regexplib, and this being
the source of the error. Do you have any other ideas?

--
Dmitry Korolyov [d_**@removethis part.mail.ru]
MVP: Windows Server - Active Directory
Nov 17 '05 #5
Agree on the first one - if that is how it works by design. Yet it is still wrong from the position of the common sense. Since an empty string does not contain one or more digits, it should not match the regexp, still it does.

"How others chose to implement their regular expression validator is irrelevant." umm well if you say so. I've used regexp with perl some time before the whole .NET thing was here. And

And disagree on the second. '\d+' means a sting containing 1 or more digits anywhere. An entire string which contains only digits - that would be '^\d+$'. Therefore, regexp is handled incorrect here also. You're making wrong assumtions regarding the entire string thing. The entire string consists of:
1. Start of the string. This is '^' character in regular expressions syntax (if placed at the very beginning of the regular expression)
2. The string itself. This is the '\d+' pattern we use for "one or more digits"
3. End of the string. This is '$' character in regular expressions sytnax (if placed at the very end of the regular expression).
This is documented in .NET regexp help so you can look yourself.

In other words, 'asdf2sdf' will match the '\d' regexp as this is a string which contains a digit. If you need a regexp for 5-digit zip code, you should use ^\d\d\d\d\d$ or ^\d{5}$ pattern. The test area at www.regexplib.com returns absolutely correct results - in terms of what is referred to as "regular expressions" by anyone who works with regular expressions. In my initial message I was wondering why my .NET framework gives incorrect results, and my suggestion is that the website uses some different version.

--
Dmitry Korolyov [d_**@removethis part.mail.ru]
MVP: Windows Server - Active Directory
"Marina" <nospam> wrote in message news:u1******** ******@tk2msftn gp13.phx.gbl...
1) .NET defines what it means for the regular expression validator to fire. And it ignores the empty string. The documentation says so - and it says to use a required field validator in addition, if your requirements are that the field be filled in.

How others chose to implement their regular expression validator is irrelevant.

2) '\d+' means that the entire string is just one or more digits. Not that there exists a substring of the original string with one or more digits.

The link you keep referring to, seems to see if there is a substring that matches.

For example, I put in '\d' for the expression, and 'asdf2sdf' for the test string.

Now, in reality, '\d' should only match a 1 character string that contains a digit. However, my string matched!

I disagree that this is actually a regular expression match for the string. There is a substring of my string that matches - but not the entire thing. In fact, absolutely anything will match, as long as there is at least one digit somewhere in it.

So the result from this web site is very misleading, and as far as I am concerned incorrect. If I am validating that someone enters a 5 digit zip code, but something 'a string 12345' is allowed to match - well, that's just plain wrong!
"Dmitry Korolyov [MVP]" <d_**@removethi spart.mail.ru> wrote in message news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Thanks Steve.

1) Why the first example works the opposite (to what I see and what you have explained) at www.regexplib.com ? They have set up a testing area where you can test various regexps and see if they match or not the strings you enter.

2) \d+ means one or more digits. They can be anywhere within the string. This means "g2323" should match the regular expression, but it doesn't (although it does on the testing area of www.regexplib.com and in any other regexp-compatible language). Note that if I wanted a string which contains digits only, I'd use ^\d+$ regexp.

So I guess there should be some more ideas...

P.S. I'm still thinking of the different versions of the framework.

--
Dmitry Korolyov [d_**@removethis part.mail.ru]
MVP: Windows Server - Active Directory
"Steve Jansen" <st*****@dev.nu l> wrote in message news:uv******** ******@TK2MSFTN GP10.phx.gbl...
Per MSDN on the RegularExpressi onValidatorCont rol:

"Note: Validation succeeds if the input control is empty. If a value is
required for the associated input control, use a RequiredFieldVa lidator
control in addition to the RegularExpressi onValidator control."

This is why it appears ^\d+$ is matched with an empty string.

Also, "d+" means match one or more "d" characters, which is why it does not
match "g24". You probably intended "^\w+$", meaning a single line string
with only alphanumerics [a-zA-Z_0-9].

-Steve Jansen

---------------------------
"Dmitry Korolyov" <d_**@removethi spart.mail.ru> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
ASP.NET app using c# and framework version 1.1.4322.573 on a IIS 6.0 web
server.

A single-line asp:textbox control and regexp validator attached to it.

^\d+$ expression does match an empty string (when you don't enter any
values) - this is wrong
d+ expression does not match, for example "g24" string - this is
also wrong

www.regexplib.com test validator works fine for both cases, i.e. it is
reporting "not match" for the first one and "match" for the second one. I am
suspecting using different framework version from regexplib, and this being
the source of the error. Do you have any other ideas?

--
Dmitry Korolyov [d_**@removethis part.mail.ru]
MVP: Windows Server - Active Directory
Nov 17 '05 #6
Dmitry Korolyov [MVP] wrote:
Thanks Steve.

1) Why the first example works the opposite (to what I see and what you
have explained) at www.regexplib.com <http://www.regexplib.c om> ? They
have set up a testing area where you can test various regexps and see if
they match or not the strings you enter.

The RegularExpressi onValidator is documented to succeed if the input
control is empty (ie., the Regexp is not even run in this case). That
might not be intuitive for you, but it's how MS decided it should work.
2) \d+ means one or more digits. They can be anywhere within the string.
This means "g2323" should match the regular expression, but it doesn't
(although it does on the testing area of
<http://www.regexplib.c om> www.regexplib.com <http://www.regexplib.c om>
and in any other regexp-compatible language). Note that if I wanted a
string which contains digits only, I'd use ^\d+$ regexp.

So I guess there should be some more ideas...
Looking at the IL for the RegularExpressi onValidator, it appears that MS
made an undocumented decision such that it will return a successful
validation only when the regex matches the entire contents of the control.

I'd agree with you that this is counter-intuitive, and it appears to be
undocumented. I'm not sure whether MS would consider this a bug in
implementation or a bug in documentation. In any case, the behavior
exists in both current versions of the Framework (1.0 SP2 and 1.1).

So, if you want your Regex's to match with the behavior that MS
hard-coded for RegularExpressi onValidator, the ValidationExpre ssion
should always be bounded by the ^ and $ characters.

P.S. I'm still thinking of the different versions of the framework.

--
Dmitry Korolyov [d_**@removethis part.mail.ru]
MVP: Windows Server - Active Directory

"Steve Jansen" <st*****@dev.nu l <mailto:st***** @dev.nul>> wrote in
message news:uv******** ******@TK2MSFTN GP10.phx.gbl...
Per MSDN on the RegularExpressi onValidatorCont rol:

"Note: Validation succeeds if the input control is empty. If a
value is
required for the associated input control, use a RequiredFieldVa lidator
control in addition to the RegularExpressi onValidator control."

This is why it appears ^\d+$ is matched with an empty string.

Also, "d+" means match one or more "d" characters, which is why it
does not
match "g24". You probably intended "^\w+$", meaning a single line
string
with only alphanumerics [a-zA-Z_0-9].

-Steve Jansen

---------------------------
"Dmitry Korolyov" <d_**@removethi spart.mail.ru
<mailto:d_**@re movethispart.ma il.ru>> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
ASP.NET app using c# and framework version 1.1.4322.573 on a IIS 6.0 web
server.

A single-line asp:textbox control and regexp validator attached to it.

^\d+$ expression does match an empty string (when you don't
enter any
values) - this is wrong
d+ expression does not match, for example "g24" string - this is
also wrong

www.regexplib.com <http://www.regexplib.c om> test validator works
fine for both cases, i.e. it is
reporting "not match" for the first one and "match" for the second
one. I am
suspecting using different framework version from regexplib, and
this being
the source of the error. Do you have any other ideas?

--
Dmitry Korolyov [d_**@removethis part.mail.ru]
MVP: Windows Server - Active Directory


--
mikeb

Nov 17 '05 #7
That's warmer Mike. But regexplib website shows us absolutely correct behavior - or do they use custom handling?

--
Dmitry Korolyov [d_**@removethis part.mail.ru]
MVP: Windows Server - Active Directory
"mikeb" <ma************ @mailnull.com> wrote in message news:OV******** ******@tk2msftn gp13.phx.gbl...
Dmitry Korolyov [MVP] wrote:
Thanks Steve.

1) Why the first example works the opposite (to what I see and what you
have explained) at www.regexplib.com <http://www.regexplib.c om> ? They
have set up a testing area where you can test various regexps and see if
they match or not the strings you enter.

The RegularExpressi onValidator is documented to succeed if the input
control is empty (ie., the Regexp is not even run in this case). That
might not be intuitive for you, but it's how MS decided it should work.
2) \d+ means one or more digits. They can be anywhere within the string.
This means "g2323" should match the regular expression, but it doesn't
(although it does on the testing area of
<http://www.regexplib.c om> www.regexplib.com <http://www.regexplib.c om>
and in any other regexp-compatible language). Note that if I wanted a
string which contains digits only, I'd use ^\d+$ regexp.

So I guess there should be some more ideas...
Looking at the IL for the RegularExpressi onValidator, it appears that MS
made an undocumented decision such that it will return a successful
validation only when the regex matches the entire contents of the control.

I'd agree with you that this is counter-intuitive, and it appears to be
undocumented. I'm not sure whether MS would consider this a bug in
implementation or a bug in documentation. In any case, the behavior
exists in both current versions of the Framework (1.0 SP2 and 1.1).

So, if you want your Regex's to match with the behavior that MS
hard-coded for RegularExpressi onValidator, the ValidationExpre ssion
should always be bounded by the ^ and $ characters.

P.S. I'm still thinking of the different versions of the framework.

--
Dmitry Korolyov [d_**@removethis part.mail.ru]
MVP: Windows Server - Active Directory



"Steve Jansen" <st*****@dev.nu l <mailto:st***** @dev.nul>> wrote in
message news:uv******** ******@TK2MSFTN GP10.phx.gbl...
Per MSDN on the RegularExpressi onValidatorCont rol:

"Note: Validation succeeds if the input control is empty. If a
value is
required for the associated input control, use a RequiredFieldVa lidator
control in addition to the RegularExpressi onValidator control."

This is why it appears ^\d+$ is matched with an empty string.

Also, "d+" means match one or more "d" characters, which is why it
does not
match "g24". You probably intended "^\w+$", meaning a single line
string
with only alphanumerics [a-zA-Z_0-9].

-Steve Jansen

---------------------------
"Dmitry Korolyov" <d_**@removethi spart.mail.ru
<mailto:d_**@re movethispart.ma il.ru>> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
ASP.NET app using c# and framework version 1.1.4322.573 on a IIS 6.0 web
server.

A single-line asp:textbox control and regexp validator attached to it.

^\d+$ expression does match an empty string (when you don't
enter any
values) - this is wrong
d+ expression does not match, for example "g24" string - this is
also wrong

www.regexplib.com <http://www.regexplib.c om> test validator works
fine for both cases, i.e. it is
reporting "not match" for the first one and "match" for the second
one. I am
suspecting using different framework version from regexplib, and
this being
the source of the error. Do you have any other ideas?

--
Dmitry Korolyov [d_**@removethis part.mail.ru]
MVP: Windows Server - Active Directory


--
mikeb

Nov 17 '05 #8
Dmitry Korolyov [MVP] wrote:
That's warmer Mike. But regexplib website shows us absolutely correct
behavior - or do they use custom handling?

There's extra code in the handling of the RegularExpressi onValidator.
Pseudo-code looks something like:

string len = controlToValida te.Text.Length;

if (len == 0) {
// nothing in the control - automatically validated
return( true);
}

Match m = regex.Match( controlToValida te.Text);

if (m.Success && (m.Length == len)) {
return( true);
}

return( false);

--
Dmitry Korolyov [d_**@removethis part.mail.ru]
MVP: Windows Server - Active Directory

"mikeb" <ma************ @mailnull.com
<mailto:ma***** *******@mailnul l.com>> wrote in message
news:OV******** ******@tk2msftn gp13.phx.gbl...
Dmitry Korolyov [MVP] wrote:
> Thanks Steve.
>
> 1) Why the first example works the opposite (to what I see and

what you
> have explained) at www.regexplib.com <http://www.regexplib.c om>

<http://www.regexplib.c om> ? They
> have set up a testing area where you can test various regexps and

see if
> they match or not the strings you enter.
>


The RegularExpressi onValidator is documented to succeed if the input
control is empty (ie., the Regexp is not even run in this case). That
might not be intuitive for you, but it's how MS decided it should work.
> 2) \d+ means one or more digits. They can be anywhere within the

string.
> This means "g2323" should match the regular expression, but it

doesn't
> (although it does on the testing area of
> <http://www.regexplib.c om> www.regexplib.com

<http://www.regexplib.c om> <http://www.regexplib.c om>
> and in any other regexp-compatible language). Note that if I

wanted a
> string which contains digits only, I'd use ^\d+$ regexp.
>
> So I guess there should be some more ideas...


Looking at the IL for the RegularExpressi onValidator, it appears
that MS
made an undocumented decision such that it will return a successful
validation only when the regex matches the entire contents of the
control.

I'd agree with you that this is counter-intuitive, and it appears to be
undocumented. I'm not sure whether MS would consider this a bug in
implementation or a bug in documentation. In any case, the behavior
exists in both current versions of the Framework (1.0 SP2 and 1.1).

So, if you want your Regex's to match with the behavior that MS
hard-coded for RegularExpressi onValidator, the ValidationExpre ssion
should always be bounded by the ^ and $ characters.
>
> P.S. I'm still thinking of the different versions of the framework.
>
> --
> Dmitry Korolyov [d_**@removethis part.mail.ru]
> MVP: Windows Server - Active Directory
>
>
>
> "Steve Jansen" <st*****@dev.nu l <mailto:st***** @dev.nul>

<mailto:st***** @dev.nul>> wrote in
> message news:uv******** ******@TK2MSFTN GP10.phx.gbl...
> Per MSDN on the RegularExpressi onValidatorCont rol:
>
> "Note: Validation succeeds if the input control is empty. If a
> value is
> required for the associated input control, use a

RequiredFieldVa lidator
> control in addition to the RegularExpressi onValidator control."
>
> This is why it appears ^\d+$ is matched with an empty string.
>
> Also, "d+" means match one or more "d" characters, which is

why it
> does not
> match "g24". You probably intended "^\w+$", meaning a

single line
> string
> with only alphanumerics [a-zA-Z_0-9].
>
> -Steve Jansen
>
> ---------------------------
> "Dmitry Korolyov" <d_**@removethi spart.mail.ru

<mailto:d_**@re movethispart.ma il.ru>
> <mailto:d_**@re movethispart.ma il.ru>> wrote in message
> news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
> ASP.NET app using c# and framework version 1.1.4322.573 on a

IIS 6.0 web
> server.
>
> A single-line asp:textbox control and regexp validator

attached to it.
>
> ^\d+$ expression does match an empty string (when you don't
> enter any
> values) - this is wrong
> d+ expression does not match, for example "g24"

string - this is
> also wrong
>
> www.regexplib.com <http://www.regexplib.c om>

<http://www.regexplib.c om> test validator works
> fine for both cases, i.e. it is
> reporting "not match" for the first one and "match" for the

second
> one. I am
> suspecting using different framework version from regexplib, and
> this being
> the source of the error. Do you have any other ideas?
>
> --
> Dmitry Korolyov [d_**@removethis part.mail.ru]
> MVP: Windows Server - Active Directory
>


--
mikeb


--
mikeb

Nov 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
7686
by: Andrew DeFaria | last post by:
I was reading my O'Reilly JavaScript The Definitive Guide when I came across RegExp and thought I could tighten up my JavaScript code that checks for a valid email address. Why does the following not appear to work: var email_address = "Joe@Schmoe"; var email_regex = new RegExp ("^(\\w+)(\@)(\\w+)(\.)(\\w+)$"); var result = email_regex.exec (email_address); alert (" result = \"" + result + "\"\n" + " result = \"" + result + "\"\n" + "...
24
3146
by: Nick Kew | last post by:
There's a new beta of the W3C Markup Validation Service now live at <URL:http://validator.w3.org:8001/> Probably the most important change is verbose output, including attempts to explain the validator errors. Other changes include improved display of error messages, and a choice of parse modes. Currently - but probably not for long - it includes an "interesting" default setting! Some of the changes have been the subject of much...
195
8566
by: Torbjørn Pettersen | last post by:
As you might have noticed I'm trying to clean up my web site's HTML code. The way I do it is simply more or less redoing to complete site, testing it on a web server I have set up on my local network. I have downloaded, and installed CSE HTML Validator Pro, but I don't get the same results with that as I do with the online validator on W3.org. And I can't upload files to W3.org either, due to all the ASP code I use.
6
1833
by: Edward | last post by:
I need to validate a text box entry, but ONLY if it is 17 characters, otherwise I have to ignore it. My regular expression for the validation is: ^(({9})()()(\d{6}))$ Can I adapt this to "fire" only if the string in question is 17 chars in length? Or do I have to do this server-side? Thanks
7
3449
by: Csaba Gabor | last post by:
I need to come up with a function function regExpPos (text, re, parenNum) { ... } that will return the position within text of RegExp.$parenNum if there is a match, and -1 otherwise. For example: var re = /some(thing|or other)?.*(n(est)(?:ed)?.*(parens) )/ var text = "There were some nesting parens in the test"; alert (regExpPos (text, re, 3));
23
2871
by: codefire | last post by:
Hi, I am trying to get a regexp to validate email addresses but can't get it quite right. The problem is I can't quite find the regexp to deal with ignoring the case james..kirk@fred.com, which is not valid. Here's my attempt, neither of my regexps work quite how I want: import os import re
2
1113
by: Nathan Sokalski | last post by:
I have the following script that I am using to test some JavaScript RegExp code: function RE() { var testing1=new RegExp("*"); var testing2=new RegExp("{0,}"); var testing3=new RegExp("+"); var testing4=new RegExp("{1,}"); window.alert(testing1.test("ab")+"\n"+testing2.test("ab")+"\n"+testing3.test("ab")+"\n"+testing4.test("ab"));}When this script is run, the window.alert contains the following results:truetruefalsefalseThe the first...
4
3904
by: Matt | last post by:
Hello all, I have just discovered (the long way) that using a RegExp object with the 'global' flag set produces inconsistent results when its test() method is executed. I realize that 'global' is not an appropriate modifier for the test() function - test() searches the entire string by default. However, I would expect it to degrade gracefully. Instead, I seem to be getting something as follows - using W3Schools handy page at :
4
2536
by: r | last post by:
Hello, It seems delimiters can cause trouble sometimes. Look at this : <script type="text/javascript"> function isDigit(s) { var DECIMAL = '\\.'; var exp = '/(^?0(' + DECIMAL
0
8707
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9174
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9015
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5947
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3158
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2520
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2110
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.