regexmatch.dev
Explore
Open main menu
Save & Share
Facebook
Twitter
Tumblr
E-Mail
Pinterest
LinkedIn
Reddit
Find any digits in string
Published on Tue Mar 01 2022
Regex
Test String
test 13231 test 123123 123 asdfasdf 1a2a3 a
Additional matching regexes for
Find any digits in string
SSN
allow nine digits only
Capture 2 digits after a dash
Find all '-' and capture 2 following digits
Phone Number E.164
Starts with + from 8 digits until 15
US Zip Code Validation
5 digits and no 0 5/4 times
Match numbers with consecutive digits
Match numbers with consecutive digits and of length 3.
Argentine postal code validation
validation for Argentina postal codes, previous four digits + new CPA
Lookahead phone test with formatting
Let's say a phone number is valid in case it has 11 digits only (13 in case of using 00 instead of +). Separators could be anywhere. Take the valid numbers and bring to common format. Original idea was deleting all non-digits but using look-ahead made impossible to use [^\d]+ for remove non-digits, it needs to capture each digits separately. Looking forward to prettier solution.
price float pattern
Checks that value is float format and has two digits at max
Credit Card finder
Captures credit card looking sequence of digits Luhn validation remains required as a complement.
trim
trim string