این محتوا تنها در این زبانها موجود است: English, Español, Français, Italiano, 日本語, Русский, Українська, Oʻzbek, 简体中文. لطفاً به ما
Java[^script]
We have a regexp /Java[^script]/.
Does it match anything in the string Java? In the string JavaScript?
Answers: no, yes.
-
In the script
Javait doesn’t match anything, because[^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. -
Yes, because the
[^script]part matches the character"S". It’s not one ofscript. As the regexp is case-sensitive (noiflag), it treats"S"as a different character from"s".