Negative Lookahead for Regex -


what difference between:

^(?!.*baa)[abc]*$ 

and

^(?!baa)[abc]*$ 

what role of .*. know means character 0 or more times why second 1 capture strings cccaabaa should discarded?

the difference between them is:

  1. ^(?!.*baa) requires baa not anywhere in input
  2. ^(?!baa) requires baa not @ the start of input

the .* allows between start ^ , baa.


Comments

Popular posts from this blog

compilation - PHP install fails on Ubuntu 14 (make: *** [sapi/cli/php] Error 1) PHP 5.6.20 -

javascript - return highlighted cells to php -

java - Creating a room by reading from a file (for a game) -