473,698 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

web regularexpressi on not working in windows

Standar 9-digit postal code expression, copied and pasted from a web
form validator expression:

@"\d{5}(-\d{4})?

I try to use it to validate a windows textbox, but it does not like
the '?'.
If the first part is matched,it doesnt care what comes afterwards.
Removing the ? gives proper behavior.

Can anyone please tell me why this is works on an asp page but not
with the Regex class?

Thanks,
Greg
Nov 15 '05 #1
2 1841
gd*****@yahoo.c om (Greg) wrote in
news:12******** *************** ***@posting.goo gle.com:
Standar 9-digit postal code expression, copied and pasted from a
web form validator expression:

@"\d{5}(-\d{4})?

I try to use it to validate a windows textbox, but it does not
like the '?'.
If the first part is matched,it doesnt care what comes
afterwards. Removing the ? gives proper behavior.

Can anyone please tell me why this is works on an asp page but
not with the Regex class?


Greg,

It may just be a typo, but are you sure the leading @" is part of the
regex? I tested the regex \d{5}(-\d{4})? on my system and it worked
fine.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 15 '05 #2

Thanks Chris,

Actually found out today that I needed the $ to mark the end of the
string even though i knew the length. I just cut and paste the
expression from the asp regularexpressi onvalidator combo, but the ^ and
$ must be prepended to those expressions.

Thanks for your help

Greg
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #3

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

Similar topics

3
5136
by: belgiozen | last post by:
Hi, I have a working windows service,it is looking for files on the disk and when some of the files are cupdated it calls an executable. But it takes a lot of time(about 10 minutes) to run the executable.So while that executable is running,if I try to stop the windows service while the executable(MYPROGRAM.EXE) is running,it will wait for a time(about 20 seconds) for the main windows thread to abort.If it does not finish its work, the...
1
1597
by: Larry Page | last post by:
Greetings, I'm using remoting to execute commands on a remote machine. My original testing used basic console client and server apps containing a common interface, which I built as a seperate DLL and referenced in each app. I've managed to wrap the remoting code up in a windows service but I'm having trouble figuring out how to implement the Interface. I'll admit up front I'm having trouble gettting my arms around some of the larger...
1
2790
by: mg | last post by:
Does someone have RegularExpression code (C# WebForm) for server-side validation of Date (mm/dd/yyyy) ... including leap year?
2
2207
by: den 2005 | last post by:
Hi everybody, How do restrict entering these characters <>\"%';()& and telling user these caharcters are not allowed to be enter in the textbox field using RegularExpression Validator? I put in the Validation Expression property . It restrict every character execpt 0 to 9. How to fixed this? I used + in validation Expression property of Regular Expression Validator Control. All are working except when entering the character \, which...
3
1746
by: Arpan | last post by:
Consider the following code which validates a TextBox using RegularExpression: <form id="form1" runat="server"> <asp:TextBox id="txt1" runat="server"/> <asp:RegularExpressionValidator ControlToValidate="txt1" ValidationExpression="{5}-{4}|{5}" ErrorMessage ="Invalid Input" Display="Dynamic" runat="server"/> <asp:Button id="btn" Text="SUBMIT" runat="server"/> </form>
1
1526
by: Arpan | last post by:
Using RegularExpression, I want to validate a TextBox so that the TextBox accepts only 8-digit numbers. This can be done with the following RegularExpression: {8} But how do I validate the TextBox so that it accepts 8-digit number or more than 8-digit numbers using RegularExpressions? Also how do I validate the TextBox so that it accepts 8 or more than
1
2034
by: prp | last post by:
hi all, I have a problem.Suppose I use a regularexpression validator for zip code. An User fill wrong entry in the relevant textbox then regularexpression validator fires.but user did not correct the entry and press the signup button . At that time i want setfocus on that zip textbox. all such things happen in asp.net and i want javascript for the setfocus.
6
3248
by: fastestindian | last post by:
Hi, I am working windows CE application. I am opening a page which has Textbox in it. In that TextBox I am showing a text report. Previously the font of text was 'Tahoma' as system font was Tahoma too. But now i want to show report in 'Corier New' Font but I am facing new.
4
1447
dmjpro
by: dmjpro | last post by:
String text = "/** */test/** */test"; System.out.println(text.replaceAll("/\\*\\*.*\\*/")); It prints test instead of testtest. How regular expression is working here?
0
8683
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, 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...
0
8611
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9031
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 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...
1
8904
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,...
0
8876
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 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...
0
7741
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6531
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4372
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...
3
2007
bsmnconsultancy
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...

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.