2 ms·
a=/(?:"Tarzan"|(Tarzan))\s+and JillOfTheJungle/; matched = !!a.exec(x)[1] Works fine. People often forget to solve the problem they need to solve (match x
by geocar 11y ago
a=/(?:"Tarzan"|(Tarzan))\s+and JillOfTheJungle/;
matched = !!a.exec(x)[1]
Works fine.
People often forget to solve the problem they need to solve (match x), and instead work on other things (find a regex to match x).
- jameshart 11y ago"People often forget to solve the problem they need to solve (match x), and instead work on other things (find a regex to match x)." Completely agree. One common mistake is building a complex regex to match the elements you want to find from a string, when an easier approach is to split the string on a simple regex that matches the things you want to throw away.