Tagged Fiddles
/^\w(?:(?:[\w -]*\w)|)$/gi
Match to allow tag like values such as _data-validation_ or _pickles_.
This pattern should allow arbitrary tags of 1+ characters. The tag cannot start or end with a dash (-) or space ( ). Any word or number character is allowed in any position.
#+
picture perfect
tag-me
w
1
15-ar
ab
#-
-w
w-
$
$fancy-pants
/\A[0-9]{5}(-[0-9]{4})?\z/
Matches US zip codes
#+ Valid Zipcodes
12345
67890
12345-5678
#- Bad :(
123-45
ABCDE
/\A[0-9]{5}(-[0-9]{4})?\z/
Matches US zip codes
#+ Valid Zipcodes
12345
67890
12345-5678
#- Bad :(
123-45
ABCDE
/\A[0-9]{5}(-[0-9]{4})?\z/
Matches US zip codes
#+ Valid Zipcodes
12345
67890
12345-5678
#- Bad :(
123-45
ABCDE
/^(?=.*\d)(?=.*\w)(?=.*\W).{8,}$/gim
Used 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
/^\w(?:(?:[\w -]*\w)|)$/gi
Match to allow tag like values such as _data-validation_ or _pickles_.
This pattern should allow arbitrary tags of 1+ characters. The tag cannot start or end with a dash (-) or space ( ). Any word or number character is allowed in any position.
#+
picture perfect
tag-me
w
1
15-ar
ab
dscsdcsd
dsd sds
sdsdsd
sdsdsd
sdsdsdsd
dssdsd
#-
-w
w-
$
$fancy-pants
((^[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
/\A[0-9]{5}(-[0-9]{4})?\z/
Matches US zip codes
#+ Valid Zipcodes
12345
67890
12345-5678
#- Bad :(
123-45
ABCDE
/^(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
/\A[0-9]{5}(-[0-9]{4})?/
Matches US zip codes
#+
12345
67890
12345-5678
#-
123-45
ABCDE
/\A[0-9]{5}(-[0-9]{4})?\z/
Matches US zip codes
#+
12345
67890
12345-5678
#-
123-45
ABCDE
/[a-z].*\d|\d.*[a-z]/gi
Used 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
/^([\d]{4}(0?[1-9]|[1][0-9]|[2][0-9])\-(0?[2])|(0?[1-9]|[12][0-9]|3[01])/(0?[13578]|1[02])|(0?[1-9]|[12][0-9]|30)/(0?[469]|11))\/$
Validates date format, including max 29 days in feb, for dates formated as DD/MM/YYYY.
2000-11
#+
31/12/1984
29/02/2012
1/1/1999
01/01/1999
#-
32/11/1984
30/02/2012
1/1/99
01/01/99w
^((0?[1-9]|[12][1-9]|3[01])\.(0?[13578]|1[02])\.20[0-9]{2}|(0?[1-9]|[12][1-9]|30)\.(0?[13456789]|1[012])\.20[0-9]{2}|(0?[1-9]|1[1-9]|2[0-8])\.(0?[123456789]|1[012])\.20[0-9]{2}|(0?[1-9]|[12][1-9])\.(0?[123456789]|1[012])\.20(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96))$
Validates date format, including max 29 days in feb, for dates formated as DD/MM/YYYY.
#+
31.12.1984
29/02/2012
1/1/1999
01/01/1999
#-
Mein TEST 322/11/1984
30.02.2012
1/1/99
01/01/99
20030306183055
/^((0?[1-9]|[1][0-9]|[2][0-9])\/(0?[2])|(0?[1-9]|[12][0-9]|3[01])\/(0?[13578]|1[02])|(0?[1-9]|[12][0-9]|30)\/(0?[469]|11))\/[\d]{4}$/
Validates date format, including max 29 days in feb, for dates formated as DD/MM/YYYY.
#+
31/12/1984
29/02/2012
1/1/1999
01/01/1999
#-
31/11/1984
30/02/2012
1/1/99
01/01/99
/(([\d]{1,4})[\/]?)+/g
Validates date format, including max 29 days in feb, for dates formated as DD/MM/YYYY.
2013\11\11
2013-09/09
2013-9-9
2013-2-28
2013-13-13
12/23/2
20.02.2014
42.02.2014
20030306183055
/(^[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
42930307W
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
/(^[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
!((^[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
!((^[XYZ]\d{7,8}|^\d{8})[A-HJ-NP-TV-Z]$)
This site has no rating
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
012345
This site has no rating
x2792336k
/(^[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
!((^[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
/[0-9a-z_\-]+@[0-9a-z\-]+\.[a-z]{2,5}/g
#+
user@example.com
#-
user@localhost
/[0-9a-z_\-]+@[0-9a-z\-]+\.[a-z]{2,5}/g
#+
us+er@example.com
#-
user@localhost
Refiddle
Do you know PHP, Perl, Python or Java? View the docs to see
how you can help out
Tags
Displaying refiddles 1 - 25 of 34 in total