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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -