Regular Expressions with JavaScript http://www.w3schools.com/jsref/jsref_match.asp no \s like in perl, so : use [\s\S]* in regex http://stackoverflow.com/questions/1068280/javascript-regex-multiline-flag-doesnt-work http://www.w3schools.com/jsref/jsref_obj_regexp.asp http://www.regular-expressions.info/javascript.html http://www.javascriptkit.com/javatutors/redev2.shtml https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions?redirectlocale=en-US&redirectslug=JavaScript%2FGuide%2FRegular_Expressions http://www.advanced-javascript-tutorial.com/RegularExpressions.cfm#.UmbpgnBwqSo h2. Code Example I assume an easier method exists to do this. h3. Get TOC info login as: root root@soupmode.com's password: Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-24-virtual i686) * Documentation: https://help.ubuntu.com/ Last login: Thu Dec 4 19:48:53 2014 from adsl-108-73-175-147.dsl.toldoh.sbcglob al.net root@soupmode:~# cd /home/nodejs/express root@soupmode:/home/nodejs/express# cd Grebe root@soupmode:/home/nodejs/express/Grebe# cd js root@soupmode:/home/nodejs/express/Grebe/js# ls -ltr total 80 -rw-r--r-- 1 root root 456 Nov 11 16:34 errors.js -rw-r--r-- 1 root root 482 Nov 11 16:34 search.js -rw-r--r-- 1 root root 1576 Nov 13 20:51 relatedposts.js -rw-r--r-- 1 root root 1562 Nov 13 20:51 showpostsource.js -rw-r--r-- 1 root root 1590 Nov 13 20:52 tags.js -rw-r--r-- 1 root root 1710 Nov 13 20:52 user.js -rw-r--r-- 1 root root 2019 Nov 14 16:45 dispatch.js.backup -rw-r--r-- 1 root root 4610 Nov 20 19:22 versions.js -rw-r--r-- 1 root root 844 Nov 20 20:22 pageglobals.js -rw-r--r-- 1 root root 11233 Nov 20 21:24 stream.js -rw-r--r-- 1 root root 2307 Nov 20 21:44 dispatch.js -rw-r--r-- 1 root root 478 Nov 20 21:46 login.js -rw-r--r-- 1 root root 4727 Dec 4 18:45 showpost.js -rw-r--r-- 1 root root 536 Dec 4 19:06 regex.js -rw-r--r-- 1 root root 812 Dec 4 19:24 regex2.js -rw-r--r-- 1 root root 680 Dec 4 20:00 regex3.js root@soupmode:/home/nodejs/express/Grebe/js# cat regex3.js var txt = "asdfasdf\nasdfasdf\nasdfasdf\n\n\n\nasdfasdf\nasdf"; var res = txt.match(//mg); for (i=0; i