Why is the third element in the array just '.1' rather than '4.5.1'? I thought that the \d+ would correspond to '3' and the (\.\d)* would capture the remaining decimals and numbers.
var re = /see (chapter \d+(\.\d)*)/i;
var str = 'For more information on regular expressions, see Chapter 3.4.5.1 and CHAPTER 2.3';
console.log(str.match(re));
Output:
[ 'see Chapter 3.4.5.1',
'Chapter 3.4.5.1',
'.1',
index: 45,
input: 'For more information on regular expressions, see Chapter 3.4.5.1 and CHAPTER 2.3' ]