var reg = /^Chapter [1-9][0-9]{0,1}/, str1 = 'Chapter 29 ', str2 = 'this is Chapter 29'; document.write('/^Chapter [1-9][0-9]{0,1}/.test(\'Chapter 29 \'): ' + reg.test(str1) + '<br>'); document.write('/^Chapter [1-9][0-9]{0,1}/.test(\'this is Chapter 29\'): ' + reg.test(str2));