Everything you need to know about writing regular expressions for PHP.
This will match img tags in HTML and pull out their src value into a separate capture group.
Regex: <img[^>]* src=\"([^\"]*)\"[^>]*>
Matching youtube urls and their IDs
Matching unique identifiers
Matching title tags
Matching a tags and their href
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.