php - Regular Expression - Negation String + OR -


i need match string not 11111 or 22222 (exact)

<?php $string = 'string' $pattern = '#patter#' // have find echo preg_match($pattern, $string) ? 'match' : 'no match'; 

cases:

$string = '33333';// match

$string = '222222';// match

$string = '11111';// no match

$string = '22222';// no match

i tried many patters google , none of them work.

note: has pure regex , not negating function preg_match

how about:

 ^(?!11111$|22222$).* 

test: https://regex101.com/r/wu7yo0/1


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -