Fix confusing wording in 9.6 (Word boundary: \b)
`\bHello\b` pattern was just analyzed in the previous paragraph, so the current wording is a bit confusing.
This commit is contained in:
parent
633db6fbe9
commit
6a61c04fc5
1 changed files with 1 additions and 1 deletions
|
@ -27,7 +27,7 @@ So, it matches the pattern `pattern:\bHello\b`, because:
|
||||||
2. Then matches the word `pattern:Hello`.
|
2. Then matches the word `pattern:Hello`.
|
||||||
3. Then the test `pattern:\b` matches again, as we're between `subject:o` and a comma.
|
3. Then the test `pattern:\b` matches again, as we're between `subject:o` and a comma.
|
||||||
|
|
||||||
The pattern `pattern:\bHello\b` would also match. But not `pattern:\bHell\b` (because there's no word boundary after `l`) and not `Java!\b` (because the exclamation sign is not a wordly character `pattern:\w`, so there's no word boundary after it).
|
So the pattern `pattern:\bHello\b` would match, but not `pattern:\bHell\b` (because there's no word boundary after `l`) and not `Java!\b` (because the exclamation sign is not a wordly character `pattern:\w`, so there's no word boundary after it).
|
||||||
|
|
||||||
```js run
|
```js run
|
||||||
alert( "Hello, Java!".match(/\bHello\b/) ); // Hello
|
alert( "Hello, Java!".match(/\bHello\b/) ); // Hello
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue