473,396 Members | 1,847 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 966
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...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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.