Update article.md
\b instead of \ in word boundary 2 example
This commit is contained in:
parent
ccc0e9327f
commit
4a9a6abf7c
1 changed files with 3 additions and 3 deletions
|
@ -101,9 +101,9 @@ So it matches `pattern:\bHello\b` and `pattern:\bJava\b`, but not `pattern:\bHel
|
|||
|
||||
```js run
|
||||
alert( "Hello, Java!".match(/\bHello\b/) ); // Hello
|
||||
alert( "Hello, Java!".match(/\Java\b/) ); // Java
|
||||
alert( "Hello, Java!".match(/\Hell\b/) ); // null
|
||||
alert( "Hello, Java!".match(/\Java!\b/) ); // null
|
||||
alert( "Hello, Java!".match(/\bJava\b/) ); // Java
|
||||
alert( "Hello, Java!".match(/\bHell\b/) ); // null
|
||||
alert( "Hello, Java!".match(/\bJava!\b/) ); // null
|
||||
```
|
||||
|
||||
Once again let's note that `pattern:\b` makes the searching engine to test for the boundary, so that `pattern:Java\b` finds `match:Java` only when followed by a word boundary, but it does not add a letter to the result.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue