DEV Community

Discussion on: The beauty of VerbalExpressions

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

I don't like this syntax. It seems overly bloated compared to the equivalent regex. Your example also doesn't include grouping, which is vital to extracing information from regex parsed strings. It also doesn't show how counted repitions, like in the regex graphic, would be used.

I'm afraid this would be ridiculously verbose for non-trival expressions.

Collapse
 
rapidnerd profile image
George

Personally I kind of see it per project, how much it'll be used and on the language in general. For some minor usage of it without having to make something overly complicated I find this would be perfect for what is needed. However I do agree with your points, some of my projects (Java and C# specifically) I've stuck with standard Regex due.

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

Perhaps there is a happy middle ground. Certainly when I'm doing basic matching I definitely prefer functions like endsWith, contains and startsWith compared to the equivalent regex.