Top "Preg-match" questions

Regular expression pattern matching function for the PHP programming language

php explode: split string into words by using space a delimiter

$str = "This is a string"; $words = explode(" ", $str); Works fine, but spaces still go into array: $words === array ('This', 'is', …

php arrays regex preg-match explode
Matching a multiple lines pattern via PHP's preg_match()

How can I match subject via a PHP preg_match() regular expression pattern in this HTML code: <table border=0&…

regex preg-match
php only allow letters, numbers, spaces and specific symbols using pregmatch

on my php i use preg_match to validate input texts. if(preg_match('/^[a-zA-Z0-9]+$/', $firstname)) { } But …

php regex string validation preg-match
preg_match(): Compilation failed: invalid range in character class at offset

Thank you in advance for you time in helping with this issue.. preg_match(): Compilation failed: invalid range in character …

php regex preg-match
Create preg_match for password validation allowing (!@#$%)

I would like to create a preg_match function to validate my passowrds, but I'm not sure how to write …

php regex passwords preg-match
Validate username as alphanumeric with underscores

On my registration page I need to validate the usernames as alphanumeric only, but also with optional underscores. I've come …

php regex preg-match
Optional Whitespace Regex

I'm having a problem trying to ignore whitespace in-between certain characters. I've been Googling around for a few days and …

php regex preg-match removing-whitespace
Regex to match an IP address

I am newbie with regex and I want to use preg_match function to find if a string is an …

php regex string ip preg-match
How can I convert ereg expressions to preg in PHP?

Since POSIX regular expressions (ereg) are deprecated since PHP 5.3.0, I'd like to know an easy way to convert the old …

php preg-replace preg-match pcre ereg
"Unknown modifier 'g' in..." when using preg_match in PHP?

This is the regex I'm trying to use: /^(\w|\.|-)+?@(\w|-)+?\.\w{2,4}($|\.\w{2,4})$/gim I found it on this …

php regex preg-match preg-match-all