DEV Community

Discussion on: Do we need Regex?

Collapse
 
moopet profile image
Ben Sinclair

I think regex are great.

Mostly, I think they're great for use outside code. With tools like vim, sed and grep.

In code, I think they can be great, but used in the right way. For example, if you want to know if a string starts with something, and your language provides a code startswith() function, you should use that.

If you want anything more complex, split the regex over multiple lines and comment it. This makes it easier to read, maintain and version-control.