3 ms·
Why would using regex pollute your code?
by pier25 7y ago
Why would using regex pollute your code?
- Normal_gaussian 7y agoIt depends on who you ask; however the thinking is often: * They can indicate poor parsing (ie can't read xml with regex) and failure to use programmatic methods (e.g parsing command output rather than making syscalls) * regexes are very easy to write incorrectly without being obviously wrong * regexes are often overkill for a direct match * regexes invite people to make it more complex rather than restructure surrounding code * regexs are comparatively more expensive than alternative code * to work on the codebase you are now required to understand regex in general and this particular implementations quirks as well I often use regexes, and I often choose not to use regexes.