DEV Community


Discussion on: How YOU can learn enough RegEx in JavaScript to be dangerous

softchris profile image
Chris Noring Author • Edited

line terminators are \n and \r.. If you have code like this that matches a string 'aa \n bb'.match(/.*/), It only matches aa, as match function only runs on the first line (\n separates line one and two). However if you use the flag g it matches all rows. So this code 'aa \n bb'.match(/.*/g) would match aa and bb

Thread Thread
tracycss profile image
Jane Tracy 👩🏽‍💻

Thank you. Very helpful

Forem Open with the Forem app