473,320 Members | 1,952 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,320 software developers and data experts.

Regex validation of the querystring

Hi, looking for some help with regex validation of a string. The string is entered by a user into a text field and is meant to be appended to the url as query string data. I'd like to use a .Net regular expression validator. So far I have ^(\/|\?|\#)+.*$ i.e can start with a / or ? or # but then can be followed by anything else which seems rather dangerous. The string should also have a limit of 255 characters. Can anyone expand on this? One thing I think is relevant is that if a # is used it has to start the string and no other special characters can follow it? Is that valid for an anchor tag?

Thanks for any help.
Feb 24 '11 #1
1 1909
Rabbit
12,516 Expert Mod 8TB
If you want to exclude certain characters, then instead of ".*" you could use "(^\/|\?|\#)*" which will match any characters except /?#.
Feb 24 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: Stefan Richter | last post by:
Hi, after coding for days on stupid form validations - Like: strings (min / max length), numbers(min / max value), money(min / max value), postcodes(min / max value), telefon numbers, email...
7
by: Robb Meade | last post by:
Hi all, A recent project that I had finished and went live with no apparant problems. My client received an email from a user who mentioned that by accident they had been typing (over the...
2
by: Angel | last post by:
Hi there, I need help pls..I'm using c# on a webform and I have this regex validation for email addresses: ValidationExpression ="\w+(\w+)*@\w+(\w+)*\.\w+(\w+)* " I'm having isssues when submit...
6
by: Vishant | last post by:
Hi, I'm new to javascript and regEx and trying to solve the following problem. I have a function which validates the password if there is a number:...
3
by: Mike | last post by:
I'm trying to have a form where a user has to enter a valid email address, and I'm trying to use the RegEx Validation control to do that. The problem is that when a user submits the form with a...
2
by: Hailstorm | last post by:
How can I control if "a textbox is empty or not" with regex validation? I don't want to use required field validator because I have a masked textbox control and it has "ValidationExpress" property....
3
by: pfeifest | last post by:
Hello- How would I validate the following statement in a REGEX validation? Thanks- pfeifest
7
by: Opa | last post by:
Hi, I'm trying to validate a textbox such that it only alpha characters are accepted. I have the following Regex expression exactly as shown in the RegularExpressionValidator control, but it...
7
by: MattMika | last post by:
Can anyone point out the problem with this? The commented regex var and if statement dont work and break the GroupName check when uncommented. I tested the AccessCodeRegxp with preg_match and it...
2
by: varunrap | last post by:
Hi, I have an application in which I need to validate a word which might have multiple variation. For example, the word "trust". I need a regex validation to pull out variations like, trusty,...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.