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

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

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

c# - Search and Add Comment with OpenXML for Word -