12 lines
523 B
Markdown
12 lines
523 B
Markdown
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.
|
|
|
|
```js run
|
|
alert( "Java".match(/Java[^script]/) ); // null
|
|
```
|
|
- Yes, because the regexp is case-insensitive, the `pattern:[^script]` part matches the character `"S"`.
|
|
|
|
```js run
|
|
alert( "JavaScript".match(/Java[^script]/) ); // "JavaS"
|
|
```
|