Hello
I'm new to this Regular Expression and need some help. I want to
restrict what the user types in a text box.
The User can type only A-Z, a-z, 0-9, spaces, comma, dash, period,
single and double quotes.
If it has anything other than that, I need to display message. How
would I do that? Any help is appreciated.
Thanks
Sue.. 1 7277
^[A-Za-z0-9\s,.-]*$
^ (anchor to start of string)
Any character in "A-Za-z0-9\s,.-"
* (zero or more times)
$ (anchor to end of string)
Note the inside the [] the period does not need to be escaped, as it's "any
character" meaning would be pointless there. And the dash does not need to
be escaped because it is last (althought, through the odd alignment of the
ASCII characters, comma-dash-period means exactly the same as
comma-period-dash.)
--
--
Truth,
James Curran
[erstwhile VC++ MVP]
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
"Sue" <su**********@e arthlink.net> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.com... Hello
I'm new to this Regular Expression and need some help. I want to restrict what the user types in a text box.
The User can type only A-Z, a-z, 0-9, spaces, comma, dash, period, single and double quotes.
If it has anything other than that, I need to display message. How would I do that? Any help is appreciated.
Thanks Sue.. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sims |
last post by:
Hi,
I need some help to split data using regular expression
Consider the string
'1,2,3', I can split it using, preg_split("/,/", '1,2,3') and i correctly
get =1, =2,=3.
Now if i have
|
by: Jorell |
last post by:
Hi everyone. I have never worked with regular expressions
before and here is my dillema:
I have a textbox that I want to only accept this type of
input:
1,2,3-8,10,16 ( Comma separated numbers or Hyphenated
ranges )
I want to use a validator for this, so I assume I use a
|
by: Sue |
last post by:
Hello
I'm new to Regular Expressions..
When the user types in a text box, I want the user to type only A-Z,
a-z, 0-9, comma, dash, period, single and double quotes.
How do I build such an expression.
Thanks
Sue..
|
by: Markus Innerebner |
last post by:
Hello to everyone,
Yesterday I tried long time to make a validation for a number format
input field.
As I am using Regex in Java I wrote following expression:
String pattern =
"((\\d+)((\\.)(\\d+)(\\,(\\d)+)?)?)|((\\d+)((\\,)(\\d+)(\\.(\\d)+)?)?)";
So the sequence of the chars of the input field could be?
|
by: Ramesh |
last post by:
I have a reguar expression syntax that works fine when used in a
RegularExpressionValidation control. If I use the exact same regular
expression using System.Text.RegularExpressions.Regex to validate, it doesn't
catch all invalid formats. This is for validating a single line text with
multiple email addresses. Validation conditions apart from the common
acceptable email formats are below:
1. the separator has to be either a comma or a...
| |
by: LordHog |
last post by:
Hello all,
I am attempting to create a small scripting application to be used
during testing. I extract the commands from the script file I was going
to tokenize the each line as one of the requirements is there one
command per line. I have always wanted to learn Regular Expressions, so
I was hoping I might do this using Regular Expressions. For a fair
number of the command will have the syntax like
Write( 0x123, 0x12, 25, 100 ) <-...
|
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: hellbent4u |
last post by:
Hi All,
I need a regular expression to be used in an ASP page which would
allow a user to enter:
1000 as well as
1,000
i.e. an amount without comma as well as with comma(for example 10,000
or 100,000 etc.)
|
by: shawnmkramer |
last post by:
Anyone every heard of the Regex.IsMatch and Regex.Match methods just
hanging and eventually getting a message "Requested Service not
found"?
I have the following pattern:
^(?<OrgCity>(+)+), City of, (?<OrgState>(()|(
+\.)))( \((?<OrgCountry>{2,})\))?$
(ignore the line wrap)
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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...
| |
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: 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: 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...
| |