Everything you need to know about writing regular expressions for PHP.
Example: aa8d2992-e371-486c-bad7-baa4dae2eef5
aa8d2992-e371-486c-bad7-baa4dae2eef5
Regex: [0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}
[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}
Matching youtube urls and their IDs
Matching title tags
Matching a tags and their href
Matching img tags and their src
Matching file extensions like .jpg
Good for matching zip and postal codes in US, UK and Canada
Keep your usernames from getting too crazy
Matching things like https://www.phpliveregex.com
Good for validating user-generated parts of URLs
Matching things like 201-867-5309
The latest tutorials sent straight to your inbox.
Share this tutorial with your community.