If you had to reinvent a new syntax for regular expressions, what would it look like?

Posted by Timwi on Programmers See other posts from Programmers or by Timwi
Published on 2010-09-02T17:50:00Z Indexed on 2011/03/10 16:19 UTC
Read the original article Hit count: 672

Filed under:
|

Regular expressions as they are today are pretty much as concise and compact as they can be. Consequently, they are often criticised for being unreadable and hard to debug.

If you had to reinvent a new syntax for regular expressions, what would it look like?

Do you prefer the concise syntax they already have (or a different but similarly concise syntax)? If so, please justify why you think regular expressions deserve to be this concise, but your favourite programming language doesn’t (unless it’s Perl).

Or do you think regular expressions should have a slightly more spaced-out syntax and look a bit more like operators and syntax elements normally do in programming languages? If so, provide examples of what you think the syntax should look like, and justify why it is better than the current syntax.

Or do you think there shouldn’t even be a special syntax for regular expressions, and instead they should be constructed from syntax elements already present in the programming language? If so, give examples of a syntax that might be used to construct such regular expressions.

© Programmers or respective owner

Related posts about syntax

Related posts about regular-expressions