I can't find official specs on Sabre PCC / iPCC max length & character requirements.
Docs usually mention PCC in commands as XXXX placeholder and I saw only 4 character uppercase alphanumeric so far...
They are always 4 alphanumeric characters.
Related
I need a regular expression to validate whether text entered in an asp.net textbox has the following format
A-za-z123456789 /s = /s A-za-z123456789
Regular expression explained:
one or more alphanumeric characters
followed by any number of spaces
an equal sign
followed by any number of spaces
one or more alphanumeric characters
[a-zA-Z0-9]*\s*\=\s*[a-zA-Z0-9]*
Replace * with + if you want one or more rather than "any" (which includes zero)
Considering your answer to the comment about requiring one or more alphanumeric characters each side:
[a-zA-Z0-9]+\s*\=\s*[a-zA-Z0-9]+
This version will only match if there is at least one alphanumeric character each side of the "=".
If zero valid
"^[a-zA-Z\\d]+\\s*=\\s*[a-zA-Z\\d]+$"
If zero not valid
"^[a-zA-Z1-9]+\\s*=\\s*[a-zA-Z1-9]+$"
Hi I'm creating a registration page. It has "Enter License Number:" i want to create a validation expression that if the user type a wrong format in that field. The form will not be submitted. It must be corrected before they submitted. I dragged the "Regular Expression Validator" in my website. But they don't have a default expression for license number. I must custom the expression to have my own expression.
Now i only want to know what is the validation expression of this sample license number:
G11-11-004064 -- A Philippines sample driver's license.
LetterNumberNumber - NumberNumber - NumberNumberNumberNumberNumberNumber
Could you convert it?
Here's a regular expression editor. It's aimed towards Ruby but will do for .NET as well:
http://rubular.com/
I don't know about the detailed specification of the license numbers you#re looking for, but I created a regex based on your example: ^[A-Z]\d{2}-\d{2}-\d{6}$.
You can modify it here:
http://rubular.com/r/7bHsX1tJ23
The example explained:
^[A-Z]\d{2}-\d{2}-\d{6}$
^ = start of line
[A-Z] = a single upper case letter
\d{2} = any number with 2 digits
\d{6} = any number with 6 digits
$ = end of line
If you want to make sure you don't miss lower case letters starting the license use [A-Za-z] instead of [A-Z]
(Thanks to Paul Sullivan)
/[A-Za-z][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9]/
I'm sure this is as basic as it gets but it will match
see online regex tested
I am trying to use a regular expression for name field in the asp.net application.
Conditions:name should be minimum 6 characters ?
I tried the following
"^(?=.*\d).{6}$"
I m completely new to the regex.Can any one suggest me what must be the regex for such condition ?
You could use this to match any alphanumeric character in length of 6 or more: ^[a-zA-Z0-9]{6,}$. You can tweak it to allow other characters or go the other route and just put in exclusions. The Regex Coach is a great environment for testing/playing with regular expressions (I wrote a blog post with some links to other tools too).
Look at Expression library and choose user name and/or password regex for you. You can also test your regex in online regex testers like RegexPlanet.
My regex suggestions are:
^[a-zA-Z][a-zA-Z0-9._\-]{5,}$
This regex accepts user names with minimum 6 characters, starting with a letter and containing only letters, numbers and ".","-","_" characters.
Next one:
^[a-zA-Z0-9._\\-]{6,}$
Similar to above, but accepts ".", "-", "_" and 0-9 to be first characters too.
If you want to validate only string length (minimum 6 characters), this simple regex below will be enough:
^.{6,}$
What about
^.{6,}$
What's all the stuff at the start of yours, and did you want to limit yourself to digits?
NRegex is a nice site for testing out regexes.
To just match 6 characters, ".{6}" is enough
In its simplest form, you can use the following:
.{6,}
This will match on 6 or more characters and fail on anything less. This will accept ANY character - unicode, ascii, whatever you are running through. If you have more requirements (i.e. only the latin alphabet, must contain a number, etc), the regex would obviously have to change.
I'm having a hard time trying to create a right regular expression for the RegularExpressionValidator control that allows password to be checked for the following:
- Is greater than seven characters.
- Contains at least one digit.
- Contains at least one special (non-alphanumeric) character.
Cant seem to find any results out there too. Any help would be appreciated! Thanks!
Maybe you will find this article helpful. You may try the following expression
^.*(?=.{8,})(?=.*[\d])(?=.*[\W]).*$
and the breakdown:
(?=.{8,}) - contains at least 8 characters
(?=.*[\d]) - contains at least one digit
(?=.*[\W]) - contains at least one special character
http://msdn.microsoft.com/en-us/library/ms972966.aspx
Search for "Lookaround processing" which is necessary in these examples. You can also test for a range of values by using .{4,8} as in Microsoft's example:
^(?=.*\d).{4,8}$
Try this
((?=.*\d)(?=.*[a-z])(?=.*[\W]).{6,20})
Description of above Regular Expression:
( # Start of group
(?=.*\d) # must contains one digit from 0-9
(?=.*[a-z]) # must contains one lowercase characters
(?=.*[\W]) # must contains at least one special character
. # match anything with previous condition checking
{7,20} # length at least 7 characters and maximum of 20
) # End of group
"/W" will increase the range of characters that can be used for password and pit can be more safe.
Use for Strong password with Uppercase, Lowercase, Numbers, Symbols & At least 8 Characters.
//Code for Validation with regular expression in ASP.Net core.
[RegularExpression(#"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\da-zA-Z]).{8,15}$")]
Regular expression password validation:
#"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\da-zA-Z]).{8,15}$"
I'm trying to create a validation expression that checks the length of an input and allows text and punctuation marks (e.g. , ? ; : ! " £ $ % )
What I have come up with so far is "^\s*(\w\s*){1,2046}\s*$" but this won't allow any punctuation marks. To be honest I'm pretty sketchy in this area so any help would be greatly appreciated!
Thanks,
Steve
^[\w\s.,:;!?€¥£¢$-]{0,2048}$
^ -- Beginning of string/line
[] -- A character class
\w -- A word character
\s -- A space character
.,:;!?€¥£¢$- -- Punctuation and special characters
{} -- Number of repeats (min,max)
$ -- End of string/line
If you're looking to allow text and punctuation what are you looking to exclude? Digits?
\D will give you everything that isn't a digit
You may already know this, but: guarding against malicious input should be handled server side, not in form validation on the client side. Black hats won't bat an eye at bypassing your script.
I think with most popular web front end frameworks there is library code for scrubbing input. A short regex alone is fairly flimsy for guarding against a SQL injection attack.
This should do it:
^\s*([\w,\?;:!"£$%]\s*){1,2046}$
Note that this doesn't limit the length of the input at all, it only limits the number of non-white-space characters.
To limit the length, you can use a positive lookahead that only matches a specific length range:
^(?=.{1,2046}$)\s*([\w,\?;:!"£$%]\s*)+$
(The upper limit on the number of non-white-space characters is pointless if it's the same as the length. The + is short for {1,}, requiring at least one non-white-space character.)
This regular expression should match all your characters and limit the input:
^\s*([\w\s\?\;\:\!\"£\$%]{1,2046})\s*$