en.javascript.info/9-regular-expressions/08-regexp-character-sets-and-ranges/1-find-range-1/solution.md
Ilya Kantor f21cb0a2f4 WIP
2019-09-04 15:44:48 +03:00

523 B

Answers: no, yes.

  • In the script subject:Java it doesn't match anything, because pattern:[^script] means "any character except given ones". So the regexp looks for "Java" followed by one such symbol, but there's a string end, no symbols after it.

    alert( "Java".match(/Java[^script]/) ); // null
    
  • Yes, because the regexp is case-insensitive, the pattern:[^script] part matches the character "S".

    alert( "JavaScript".match(/Java[^script]/) ); // "JavaS"