//([sS]*?) matches any character including newline var result = str.match(/<script>([sS]*?)</script>/g)