J'essaie de créer une regex pour capturer les emails ne se terminant pas .info/.con ne contenant pas aaa/bbb.preg_match_all ignore les mots
Est-ce la syntaxe correcte?
Eg: // search email ending in .com/.info containing no aaa/bbb
preg_match_all('#((?=.*@.*(?:com|info))(!.*(?:aaa|bbb)).*)#ui', $html, $emails);
Pour obtenir:
[email protected] = no
[email protected] = no
[email protected] = good (address syntax correct + term absent before or after the @)
Merci pour votre réponse.
Cette syntaxe fonctionne bien SEE HERE (merci à STEMA) à l'exception d'une chaîne qui inclut des espaces.
par exemple:
$string = "[email protected] blah [email protected] blah [email protected] [email protected]";
preg_match_all("#^(?!.*aaa)(?!.*bbb).*@.*\.(?:com|info)$#im", $string, $matches);
Cordially
Il peut y avoir plusieurs e-mails à capturer et ne contenant pas les mots interdits (aaa | bbb) dans une page HTML pour analyser. – StackOverflowCom