I have problem with this regex:
(\\[|\\])[0-9]+,([0-9]+(\\[|\\])|inf\\])\\s?.*
When you use the RegExp construct, you need to double escape with your backslashes:
RegExp
var rangeRegex = new RegExp("(\\[|\\])[0-9]+,([0-9]+(\\[|\\])|inf\\])\\s?.*");
Or use a literal one::
var rangeRegex = /(\[|\])[0-9]+,([0-9]+(\[|\])|inf\])\s?.*/;