There is no modifier g
for preg_match
. Instead, you have to use the preg_match_all
function.
So instead of:
preg_match("/^(\w|\.|-)+?@(\w|-)+?\.\w{2,4}($|\.\w{2,4})$/gim", ....)
use:
preg_match_all("/^(\w|\.|-)+?@(\w|-)+?\.\w{2,4}($|\.\w{2,4})$/im", ....)
More Related Contents:
- Get repeated matches with preg_match_all()
- PHP regular expressions: No ending delimiter ‘^’ found in
- Delimiter must not be alphanumeric or backslash and preg_match
- preg_match(): Compilation failed: invalid range in character class at offset
- Optional Whitespace Regex
- Split camelCase word into words with php preg_match (Regular Expression)
- PHP – regex to allow letters and numbers only
- Extracting all values between curly braces regex php
- PHP’s preg_match() and preg_match_all() functions
- Function eregi() is deprecated [duplicate]
- Unknown modifier ‘/’ in …? what is it? [duplicate]
- How to search in an array with preg_match?
- How to get all captures of subgroup matches with preg_match_all()? [duplicate]
- How to validate a domain name using Regex & PHP?
- Regular expression preg_quote symbols are not detected
- Test if a string is regex
- PHP email validation [duplicate]
- How to validate that a string only contain lowercase letters?
- How to get the shortest rather than longest possible regex match with preg_match()
- Get non-numeric characters then number on each line of a block of texf
- Detecting a url using preg_match? without http:// in the string
- Regex to match an IP address [closed]
- regular expression [closed]
- Regex to validate range of numbers from 50 to 1000 with step of 50 [closed]
- How to split a string by multiple delimiters in PHP?
- Convert string into slug with single-hyphen delimiters only
- PHP Regex find text between custom added HTML Tags
- regex matching links without tag
- Regex & PHP – isolate src attribute from img tag
- PHP regex for validating a URL