473,395 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Regex Object crashes IE

The following code

Expand|Select|Wrap|Line Numbers
  1. function checkAlphanumeric(field,msg,errorspan){
  2. var alphanmuer= /^[A-Za-z][-A-Za-z0-9_ ]{0,49}$/;
  3. var strValue = document.getElementById(field).value;
  4. if(strValue.length>1){
  5. if (strValue.search(alphanmuer)!=-1) {
  6. document.getElementById(errorspan).innerHTML = '';
  7. return;
  8. }
  9. else{
  10.  
  11. document.getElementById(errorspan).innerHTML = msg;
  12. document.getElementById(field).focus();
  13. document.getElementById(field).select();
  14. return;
  15. }
  16. }
  17. else{
  18. document.getElementById(errorspan).innerHTML = msg;
  19. document.getElementById(field).focus();
  20. document.getElementById(field).select();
  21. return;
  22. }
  23. }
  24.  
used with
<input type="text" name="username" id="username" onblur="javascript:
return checkAlphanumeric('username','Error: Please enter Alpha Numeric
only only.','username_error');"/>
always crashes IE and i dont see why.
help :)

Nov 11 '05 #1
1 1290
wrote on 11 nov 2005 in comp.lang.javascript:
var alphanmuer= /^[A-Za-z][-A-Za-z0-9_ ]{0,49}$/;
var strValue = document.getElementById(field).value; if (strValue.search(alphanmuer)!=-1) {


if (!/^[a-z][- \w]{2,49}$/i.test(strValue)) {

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Nov 11 '05 #2

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

Similar topics

3
by: Jon Maz | last post by:
Hi All, Am getting frustrated trying to port the following (pretty simple) function to CSharp. The problem is that I'm lousy at Regular Expressions.... //from...
2
by: Richard Latter | last post by:
Hello All, I am a newbie to the Boost library and I have a question about a simple function. All I would like to do is to create a simple function that can test strings using regular...
4
by: aevans1108 | last post by:
expanding this message to microsoft.public.dotnet.xml Greetings Please direct me to the right group if this is an inappropriate place to post this question. Thanks. I want to format a...
9
by: Tim Conner | last post by:
Is there a way to write a faster function ? public static bool IsNumber( char Value ) { if (Regex.IsMatch( Value.ToString(), @"^+$" )) { return true; } else return false; }
3
by: Jeff McPhail | last post by:
I am using Regex.Match in a large application and the memory is growing out of control. I have tried several ways to try and release the memory and none of them work. Here are some similar examples...
6
by: BigAl | last post by:
Perhaps someone here can help me out... RegEx: "^.*\d{5}(-\d{4})?.*$" Intended Purpose: To strip out the City/State/ZipCode line from a signature. Sample Text: Joe Jackson 131 W. 5th...
20
by: jeevankodali | last post by:
Hi I have an .Net application which processes thousands of Xml nodes each day and for each node I am using around 30-40 Regex matches to see if they satisfy some conditions are not. These Regex...
6
by: Rob | last post by:
I have built a class called DTLineScrub that inherits Regex. All works well with the code below until I try to do a replace on a string. It then tells me that the object was not instantiated. ...
2
by: Tomislav Fistric | last post by:
Hi all. I have very uncommon problem. I am running IIS 6.0 on 2xXEON dual core 3.06 (8 virtual CPUs) with 4 gb of Ecc ram and i get system.outofmemory exception on asp.net website. Thing is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.