473,396 Members | 2,034 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,396 software developers and data experts.

Please help with this regex

Hi,
I have a text box on a form and I am validating the data(street address)
with the following expression
^[a-zA-Z\d]+(([\'\,\.\- #][a-zA-Z\d ])?[a-zA-Z\d]*[\.]*)*$.

The following address works excellent
23-89 New Street
1 south william street

The problem is I try puting "N'Select" and that was passed instead of fail.
Can anyone tell me why is my expression passing this?

Thanks

Oct 25 '05 #1
1 967
Chris wrote:
I have a text box on a form and I am validating the data(street address)
with the following expression
^[a-zA-Z\d]+(([\'\,\.\- #][a-zA-Z\d ])?[a-zA-Z\d]*[\.]*)*$.

The following address works excellent
23-89 New Street
1 south william street

The problem is I try puting "N'Select" and that was passed instead of fail.
Can anyone tell me why is my expression passing this?


"N" matches "^[a-zA-Z\d]+".
"'S" matches "([\'\,\.\- #][a-zA-Z\d ])?".
"elect" matches "[a-zA-Z\d]*[\.]*".

--

still in the sling!
Oct 25 '05 #2

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

Similar topics

6
by: Dave | last post by:
I'm struggling with something that should be fairly simple. I just don't know the regext syntax very well, unfortunately. I'd like to parse words out of what is basically a boolean search...
3
by: Richard | last post by:
Trying to wrap my brain around Regex for the first time... I need to be able to replace Sql @NamedParameters with "?" for compliance with an extremely lame 3rd party Odbc driver. I know that...
3
by: Richard | last post by:
Hi, We have a bunch of strings in the following format: yyyy yyyyy We would like to keep all of the "xxxxx" data - anything that falls within the square brackets. We know that Regex can...
8
by: Sandy | last post by:
Hello - This code was snagged by me from the Internet and altered. Its purpose is to check for swear words. It works the way it currently is, but I need it to be more generic -- i.e., I don't...
4
by: Krakatioison | last post by:
My problem is simple, but I spent lot of time playing with regex and I am going nuts. I need to automatically (many times per day) extract HEADING and DESCRIPTION from the html code below? ...
31
by: Extremest | last post by:
I have a loop that is set to run as long as the arraylist is > 0. at the beginning of this loop I grab the first object and then remove it. I then go into another loop that checks to see if there...
4
by: MooMaster | last post by:
I'm trying to develop a little script that does some string manipulation. I have some few hundred strings that currently look like this: cond(a,b,c) and I want them to look like this: ...
29
by: gs | last post by:
let say I have to deal with various date format and I am give format string from one of the following dd/mm/yyyy mm/dd/yyyy dd/mmm/yyyy mmm/dd/yyyy dd/mm/yy mm/dd/yy dd/mmm/yy mmm/dd/yy
5
by: Nemisis | last post by:
Hi everyone, I am currently building my .Net website, everything was fine, until i decided to put some generic functions into a module. The module is located in App_Code, with 2 other of my...
5
by: jeddiki | last post by:
Hi, I am using the following regex to check for valid email addresses, but I am getting errors. if (preg_match('\^+@+\.{2,4}$\',$regex)){ echo "VALID"; } else { echo "INVALID";
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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.