Word boundaries in regexes in JavaScript

Using the command '\b' one can access to a word boundary, while using the command '\B' not to the boundary. Let's see how these commands work with examples.

Example

Let's wrap each word in the character '!':

let str = 'aaa aaa aaa'; let res = str.replace(/\b/g, '!');

As a result, the following will be written to the variable:

'!aaa! !aaa! !aaa!'

Example

Let's add the character '!' between the letters:

let str = 'aaa aaa aaa'; let res = str.replace(/\B/g, '!');

As a result, the following will be written to the variable:

'a!a!a a!a!a a!a!a'

Given a string:

let str = 'abc def xyz';

Write a regex that will make this string as following:

'#abc# #def# #xyz#';

Given a string:

let str = 'abc def xyz';

Write a regex that will make this string as following:

'a+b+c d+e+f x+y+z';
enru