Hi All,
I've got a textbox where I want to make sure the person has entered at least
3 characters before submitting (it's like a partial name lookup type of
query), so I don't want them to just enter "a" or "e" in the box and bring
back everyone with an "a" or "e" in their name.
I figure that a regular expression validation is the way to go, and I tried
this:
ValidationExpre ssion="^([a-zA-z0-9\s]{3,255})$"
However, this doesn't work all the time, because a user can enter "dr." or
"st." and that is 3 characters but the validation fails, because the "." is
not recognized as a character.
So, can some kind soul help me out with the accurate regular expression for
what I want to accomplish?
Thanks,
Brian 4 1733
Hi Brian,
Why a regular expression? I would just use "TextBox.Text.. Length 3".
If you really want a regualr expression, try ".{3,255}". The "." will
match anything (except newlines).
Ethan
Ethan Strauss Ph.D.
Bioinformatics Scientist
Promega Corporation
2800 Woods Hollow Rd.
Madison, WI 53711
608-274-4330
800-356-9526 et***********@p romega.com
"Brian Simmons" wrote:
Hi All,
I've got a textbox where I want to make sure the person has entered at least
3 characters before submitting (it's like a partial name lookup type of
query), so I don't want them to just enter "a" or "e" in the box and bring
back everyone with an "a" or "e" in their name.
I figure that a regular expression validation is the way to go, and I tried
this:
ValidationExpre ssion="^([a-zA-z0-9\s]{3,255})$"
However, this doesn't work all the time, because a user can enter "dr." or
"st." and that is 3 characters but the validation fails, because the "." is
not recognized as a character.
So, can some kind soul help me out with the accurate regular expression for
what I want to accomplish?
Thanks,
Brian
ValidationExpre ssion= ".{3,255}"
Btw the ^ and $ at the beginning and end of the expression are redundant in
RegularExpressi onValidator since the validation code checks that the match
occurs at position zero and match length equals validated string length.
"Brian Simmons" <ce******@newsg roup.nospamwrot e in message
news:OX******** ******@TK2MSFTN GP05.phx.gbl...
Hi All,
I've got a textbox where I want to make sure the person has entered at
least 3 characters before submitting (it's like a partial name lookup type
of query), so I don't want them to just enter "a" or "e" in the box and
bring back everyone with an "a" or "e" in their name.
I figure that a regular expression validation is the way to go, and I
tried this:
ValidationExpre ssion="^([a-zA-z0-9\s]{3,255})$"
However, this doesn't work all the time, because a user can enter "dr." or
"st." and that is 3 characters but the validation fails, because the "."
is not recognized as a character.
So, can some kind soul help me out with the accurate regular expression
for what I want to accomplish?
Thanks,
Brian
On 28 , 20:01, "Brian Simmons" <centr...@newsg roup.nospamwrot e:
Hi All,
I've got a textbox where I want to make sure the person has entered at least
3 characters before submitting (it's like a partial name lookup type of
query), so I don't want them to just enter "a" or "e" in the box and bring
back everyone with an "a" or "e" in their name.
I figure that a regular expression validation is the way to go, and I tried
this:
ValidationExpre ssion="^([a-zA-z0-9\s]{3,255})$"
However, this doesn't work all the time, because a user can enter "dr." or
"st." and that is 3 characters but the validation fails, because the "." is
not recognized as a character.
So, can some kind soul help me out with the accurate regular expression for
what I want to accomplish?
Thanks,
Brian
If you want limit possible characters with letters, numbers and dot:
[a-zA-Z0-9\.]{3,}
It can be shorter [\w\.]{3,} but in that case it also allows
underscore.
Regards,
Mykola http://marss.co.ua
Hello Sherif,
ValidationExpre ssion= ".{3,255}"
Btw the ^ and $ at the beginning and end of the expression are
redundant in RegularExpressi onValidator since the validation code
checks that the match occurs at position zero and match length equals
validated string length.
You might also want to take alook at this article: http://www.informit.com/articles/art...&seqNum=6&rl=1
It describes how to make a CustomValidator which will do a length check.
Should be quite simple to let it check both min and maxlength.
"Brian Simmons" <ce******@newsg roup.nospamwrot e in message
news:OX******** ******@TK2MSFTN GP05.phx.gbl...
>Hi All,
I've got a textbox where I want to make sure the person has entered at least 3 characters before submitting (it's like a partial name lookup type of query), so I don't want them to just enter "a" or "e" in the box and bring back everyone with an "a" or "e" in their name.
I figure that a regular expression validation is the way to go, and I tried this: ValidationExpr ession="^([a-zA-z0-9\s]{3,255})$" However, this doesn't work all the time, because a user can enter "dr." or "st." and that is 3 characters but the validation fails, because the "." is not recognized as a character.
So, can some kind soul help me out with the accurate regular expression for what I want to accomplish?
Thanks, Brian
--
Jesse Houwing
jesse.houwing at sogeti.nl This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Vibha Tripathi |
last post by:
Hi Folks,
I put a Regular Expression question on this list a
couple days ago. I would like to rephrase my question
as below:
In the Python re.sub(regex, replacement, subject)
method/function, I need the second argument
'replacement' to be another regular expression ( not a
string) . So when I find a 'certain kind of string' in
|
by: Bradley Plett |
last post by:
I'm hopeless at regular expressions (I just don't use them often
enough to gain/maintain knowledge), but I need one now and am looking
for help. I need to parse through a document to find a URL, and then
reconstruct another URL based on it. For example, I need to scan a
web page looking for something like <a
href="some_dir/list_20050815100225.csv">. I don't know in advance
what the date/time in the file name will be. I need to take the...
|
by: Lee Kuhn |
last post by:
I am trying the create a regular expression that will essentially match
characters in the middle of a fixed-length string. The string may be any
characters, but will always be the same length. In other words, as the
regular expression (....)($) matches the "4567" in the string "1234567", how
would I create a similar regular expression that only matches the "45" in
the same string. The same regular expression would match "32" in the string...
|
by: Q. John Chen |
last post by:
I have Vidation Controls
First One: Simple exluce certain special characters:
say no a or b or c in the string:
*
Second One:
I required date be entered in "MM/DD/YYYY" format:
//+4 How ??
|
by: Ryan |
last post by:
HELLO
I am using the following MICROSOFT SUGGESTED (somewhere on msdn)
regular expression to validate email addresses however I understand
that the RFP allows for "+" symbols in the email address and this
method does not....
Does anyone have an explanation?
Function IsValidEmail(ByVal strIn As String) As Boolean
| |
by: norton |
last post by:
Hello,
Does any one know how to extact the following text into 4 different
groups(namely Date, Artist, Album and Quality)?
- Artist - Album
Artist - Album
- Artist - Album
- Artist - Album-
i have try this syntax but it failed
|
by: Billa |
last post by:
Hi,
I am replaceing a big string using different regular expressions (see
some example at the end of the message). The problem is whenever I
apply a "replace" it makes a new copy of string and I want to avoid
that. My question here is if there is a way to pass either a memory
stream or array of "find", "replace" expressions or any other way to
avoid multiple copies of a string.
Any help will be highly appreciated
|
by: Ludwig |
last post by:
Hi,
i'm using the regular expression \b\w to find the beginning of a word,
in my C# application. If the word is 'public', for example, it works.
However, if the word is '<public', it does not work: it seems that <
is not a valid character, so the beginning of the word starts at
theletter 'p' instead of '<'.
Because I'm not an expert in regular expressions, maybe someone of you
guys can help me? I need the correct regex to find the...
|
by: Zach |
last post by:
Hello,
Please forgive if this is not the most appropriate newsgroup for this
question. Unfortunately I didn't find a newsgroup specific to regular
expressions.
I have the following regular expression.
^(.+?) uses (?!a spoon)\.$
|
by: Mike |
last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in
matches. I would like to get what the actual regular expression is.
In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART (CONDUCTION
DEFECT) 37.33/2 HEART (CONDUCTION DEFECT) WITH
CATHETER 37.34/2 " the expression is "HEART (CONDUCTION DEFECT)". How
do I gain access to the expression (not the matches) at runtime?
Thanks,
Mike
|
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...
| |
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,...
|
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...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |