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

gcc - MinGW's ld cannot perform PE operations on non PE output file -

How to connect android app to App engine -

hadoop - Running Map Reduce Job shows error - Mkdirs failed to create /var/folders/ -