2 ms·
/* That revolting regular expression explained /^(\w+)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/ \---/ \---/\-------------/ \-------/ |
by swyx 4y ago
/* That revolting regular expression explained
/^(\w+)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/
\---/ \---/\-------------/ \-------/
| | | |
| | | The value
| | ~,|,^,$,* or =
| Attribute
Tag
*/
all regexes should have ascii art explainers!
(from https://static.simonwillison.net/static/2003/getElementsBySelector.js https://static.simonwillison.net/static/2003/getElementsBySe...)