Tagged Fiddles
- 1RevisionsForks
Require at least one letter, number and a special character
/^(?=.*\d)(?=.*\w)(?=.*\W).{8,}$/gimUsed to enforce that a password (in our case) contains at least one letter (a-zA-Z), one number and one special character and is at least 8 chars long, in any order.#- Don't match these failtest 123456789 "!#%€#"&"%€/ @#a23 #+ Match these l3agal#12332 l#eg1a11 123abc@#$ @#$abc123 @#$ABc123 @#$123abc !gre$veor%.32 - 1RevisionsForks
Decimal Number Format
/^[-+]?(?:(?:[1-9]\d{0,2}(?:(?:,\d{3})*|\d*)(?:\.\d+)?)|0\.\d+)(?:[e|E]\d+)?$/gmPattern to match decimal number formats.#+ SHOULD MATCH 1.2e4 1.6E6 561 +516516 1.5 4 -1.5 1e566 106 106,123,123 111,015E166 10,000,000 0.123E123 1,000.0 100,000.0 10.0E1 23.08E66 #- SHOULD NOT MATCH 111.0.1 0. 100000.1E 11,1111 006 012 0,123 1.e155 156,1651,51.515 156,1651,5e6116 561.48.888 192.168.100.1 720p 156,1651,161, ,165.165E1655 ,16,,,,,,,,5.165E1655 ,2666 aaaa 111111,111,111 - 1RevisionsForks
X5138982T
((^[XYZ]\d{7,8}|^\d{8})[A-HJ-NP-TV-Z]$)Simple regex to see if a string is a valid DNI/NIE number. DNI/NIE numbers are spanish identification numbers. DNI are for spanish nationals and NIE are for foreigners living in Spain. This will only take you so far. To fully verify the DNI/NIE you will have to: DNI: Take the part in front of the letter. Convert it to a number. User modulus 23 on it. Use the result to index into TRWAGMYFPDXBNJZSQVHLCKE and see if the last letter matches (so for 01234567H you would run 1234567%23 = 19 and the 19:th char in the array is C, the number is not a valid DNI) NIE: If the number is 8 digits long cut the leading letter and run the rest as if it was a DNI. If the number is 7 digits long change the leading letter to a number (X->0, Y->1, Z->2) and run it as if it was a DNI.#+ Some simple tests # Valid NIE format X1234567G Y0336380L # Valid NIE, old format X01234567H X09375379G # Valid DNI format 01234567J 39027217N 77122981W 37354021F #- Random variations and common mistakes G1234567G X1234567U 1234567U 234567H X-1234567G 01234567JJ 01234567j - 1RevisionsForks
Decimal numbers with 2 decimal or more
/^(\d{1,2}\,*\d*)$/mg5,1 314,1234 0,123 ,31232 88,88 88,888 32,0 80 50 40 $5.1 $314.1234 $0.123 $.31232 $32 £5.1 £314.1234 £0.123 £.31232 £32 ¥5.1 ¥314.1234 ¥0.123 ¥.31232 ¥32 - 1Revisions0Forks
Organization number
/^(16)?[1-9]\d[2-9]\d{7}$/Validates a string of numbers as a correctly formatted (but maybe invalid) Swedish organization number (like a social security number for a business or other legal entity that is not a physical person).#+ Orgnumbers 165568537889 9697665702 5567711014 9697147537 5569068611 5569219669 5569289670 5569209710 5567782031 165569323743 5569163990 2023255058 169697187814 169697214048 5565977468 6692519281 165568546740 #- Other 7908223166 - 1Revisions1Forks
Require at least one letter and number
/[a-z].*\d|\d.*[a-z]/giUsed to enforce that a password (in our case) contains at least one letter (a-z) and one number, in any order.#- Don't match these failtest 123456789 "!#%€#"&"%€/ #+ Match these l3agal lega1 1a 1€%b b€%&/a1 - 1Revisions0Forks
Currency
/^\$?[0-9]{1,}(|[.]{1}[0-9]{1,2})$/Currency Regex upto 1 Billion with 2 decimal points.#+ should match 32423 999.00 3242.32 1000000000.00 999 1.1 0.12 100000000000000 10000000000.00 $1 $10 $1111.2 $1111.22 #- should not match .12 . a 11.1111111111111 34223.376 $1111.2a $1111.222 - 1Revisions11Forks
DNI/NIE validation
/(^[XYZ]\d{7}\d?Simple regex to see if a string is a valid DNI/NIE number. DNI/NIE numbers are spanish identification numbers. DNI are for spanish nationals and NIE are for foreigners living in Spain. This will only take you so far. To fully verify the DNI/NIE you will have to: DNI: Take the part in front of the letter. Convert it to a number. User modulus 23 on it. Use the result to index into TRWAGMYFPDXBNJZSQVHLCKE and see if the last letter matches (so for 01234567H you would run 1234567%23 = 19 and the 19:th char in the array is C, the number is not a valid DNI) NIE: If the number is 8 digits long cut the leading letter and run the rest as if it was a DNI. If the number is 7 digits long change the leading letter to a number (X->0, Y->1, Z->2) and run it as if it was a DNI.#+ Some simple tests # Valid NIE X1234567G # Valid, old NIE X01234567H X09375379G # Valid DNI 01234567H 39027217N 77122981W 37354021F 46724451c #- Random variations and common mistakes G1234567G X1234567U 1234567U 234567H X-1234567G - 1Revisions24Forks
42930307W
42930307WSimple regex to see if a string is a valid DNI/NIE number. DNI/NIE numbers are spanish identification numbers. DNI are for spanish nationals and NIE are for foreigners living in Spain. This will only take you so far. To fully verify the DNI/NIE you will have to: DNI: Take the part in front of the letter. Convert it to a number. User modulus 23 on it. Use the result to index into TRWAGMYFPDXBNJZSQVHLCKE and see if the last letter matches (so for 01234567H you would run 1234567%23 = 19 and the 19:th char in the array is C, the number is not a valid DNI) NIE: If the number is 8 digits long cut the leading letter and run the rest as if it was a DNI. If the number is 7 digits long change the leading letter to a number (X->0, Y->1, Z->2) and run it as if it was a DNI.#+ Some simple tests # Valid NIE format X1234567G Y0336380L # Valid NIE, old format X01234567H X09375379G # Valid DNI format 01234567J 39027217N 77122981W 37354021F #- Random variations and common mistakes G1234567G X1234567U 1234567U 234567H X-1234567G 01234567JJ 01234567j - 1Revisions16Forks
X08857353F
/(^[XYZ]\d{7,8}|^\d{8})[A-HJ-NP-TV-Z]$/Simple regex to see if a string is a valid DNI/NIE number. DNI/NIE numbers are spanish identification numbers. DNI are for spanish nationals and NIE are for foreigners living in Spain. This will only take you so far. To fully verify the DNI/NIE you will have to: DNI: Take the part in front of the letter. Convert it to a number. User modulus 23 on it. Use the result to index into TRWAGMYFPDXBNJZSQVHLCKE and see if the last letter matches (so for 01234567H you would run 1234567%23 = 19 and the 19:th char in the array is C, the number is not a valid DNI) NIE: If the number is 8 digits long cut the leading letter and run the rest as if it was a DNI. If the number is 7 digits long change the leading letter to a number (X->0, Y->1, Z->2) and run it as if it was a DNI.#+ Some simple tests # Valid NIE format X1234567G Y0336380L # Valid NIE, old format X01234567H X09375379G # Valid DNI format 01234567J 39027217N 77122981W 37354021F #- Random variations and common mistakes G1234567G X1234567U 1234567U 234567H X-1234567G - 1Revisions23Forks
53653876M
!((^[XYZ]\d{7,8}|^\d{8})[A-HJ-NP-TV-Z]$)Simple regex to see if a string is a valid DNI/NIE number. DNI/NIE numbers are spanish identification numbers. DNI are for spanish nationals and NIE are for foreigners living in Spain. This will only take you so far. To fully verify the DNI/NIE you will have to: DNI: Take the part in front of the letter. Convert it to a number. User modulus 23 on it. Use the result to index into TRWAGMYFPDXBNJZSQVHLCKE and see if the last letter matches (so for 01234567H you would run 1234567%23 = 19 and the 19:th char in the array is C, the number is not a valid DNI) NIE: If the number is 8 digits long cut the leading letter and run the rest as if it was a DNI. If the number is 7 digits long change the leading letter to a number (X->0, Y->1, Z->2) and run it as if it was a DNI.#+ Some simple tests # Valid NIE format X1234567G Y0336380L 20-25922497-9 # Valid NIE, old format X01234567H X09375379G # Valid DNI format 01234567J 39027217N 77122981W 37354021F #- Random variations and common mistakes G1234567G X1234567U 1234567U 234567H X-1234567G 01234567JJ 01234567j - 1Revisions25Forks
check
!((^[XYZ]\d{7,8}|^\d{8})[A-HJ-NP-TV-Z]$) This site has no ratingSimple regex to see if a string is a valid DNI/NIE number. DNI/NIE numbers are spanish identification numbers. DNI are for spanish nationals and NIE are for foreigners living in Spain. This will only take you so far. To fully verify the DNI/NIE you will have to: DNI: Take the part in front of the letter. Convert it to a number. User modulus 23 on it. Use the result to index into TRWAGMYFPDXBNJZSQVHLCKE and see if the last letter matches (so for 01234567H you would run 1234567%23 = 19 and the 19:th char in the array is C, the number is not a valid DNI) NIE: If the number is 8 digits long cut the leading letter and run the rest as if it was a DNI. If the number is 7 digits long change the leading letter to a number (X->0, Y->1, Z->2) and run it as if it was a DNI.#+ Some simple tests # Valid NIE format X1234567G Y0336380L # Valid NIE, old format X01234567H X09375379G # Valid DNI format 01234567J 39027217N 77122981W 37354021F #- Random variations and common mistakes G1234567G X1234567U 1234567U 234567H X-1234567G 012345 This site has no rating x2792336k - 1Revisions7Forks
DNI/NIE validation
/(^[XYZ]\d{7}\d?|^\d{8})[A-HJ-NP-TV-Z]$/Simple regex to see if a string is a valid DNI/NIE number. DNI/NIE numbers are spanish identification numbers. DNI are for spanish nationals and NIE are for foreigners living in Spain. This will only take you so far. To fully verify the DNI/NIE you will have to: DNI: Take the part in front of the letter. Convert it to a number. User modulus 23 on it. Use the result to index into TRWAGMYFPDXBNJZSQVHLCKE and see if the last letter matches (so for 01234567H you would run 1234567%23 = 19 and the 19:th char in the array is C, the number is not a valid DNI) NIE: If the number is 8 digits long cut the leading letter and run the rest as if it was a DNI. If the number is 7 digits long change the leading letter to a number (X->0, Y->1, Z->2) and run it as if it was a DNI.#+ Some simple tests # Valid NIE X1234567G # Valid, old NIE X01234567H X09375379G # Valid DNI 01234567H 39027217N 77122981W 37354021F 46724451C #- Random variations and common mistakes G1234567G X1234567U 1234567U 234567H X-1234567G - 2Revisions47Forks
94889283M
!((^[XYZ]\d{7,8}|^\d{8})[A-HJ-NP-TV-Z]$)Simple regex to see if a string is a valid DNI/NIE number. DNI/NIE numbers are spanish identification numbers. DNI are for spanish nationals and NIE are for foreigners living in Spain. This will only take you so far. To fully verify the DNI/NIE you will have to: DNI: Take the part in front of the letter. Convert it to a number. User modulus 23 on it. Use the result to index into TRWAGMYFPDXBNJZSQVHLCKE and see if the last letter matches (so for 01234567H you would run 1234567%23 = 19 and the 19:th char in the array is C, the number is not a valid DNI) NIE: If the number is 8 digits long cut the leading letter and run the rest as if it was a DNI. If the number is 7 digits long change the leading letter to a number (X->0, Y->1, Z->2) and run it as if it was a DNI.#+ Some simple tests # Valid NIE format X1234567G Y0336380L # Valid NIE, old format X01234567H X09375379G # Valid DNI format 01234567J 39027217N 77122981W 37354021F #- Random variations and common mistakes G1234567G X1234567U 1234567U 234567H X-1234567G 01234567JJ 01234567j