Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Interesting Idea: Stop writing Regular Expressions. Express them with Verbal Expressions. (VerbalExpressions turns the often-obscure-and-tricky-to-type regular expression operators into descriptive, chainable functions. )
Interesting Idea: Stop writing Regular Expressions. Express them with Verbal Expressions. [message #45027] Fri, 21 August 2015 14:55 Go to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Stop writing Regular Expressions. Express them with Verbal Expressions.

GitHub user jehna has fashioned a runaway hit with his unique way of constructing difficult regular expressions.

VerbalExpressions turns the often-obscure-and-tricky-to-type regular expression operators into descriptive, chainable functions. The result of this is quite astounding. Here's the example URL tester from the README:

VerEx tester = VerEx()
            .startOfLine()
            .then( "http" )
            .maybe( "s" )
            .then( "://" )
            .maybe( "www." )
            .anythingBut( " " )
            .endOfLine();

This style may be off-putting to old-school regex pros, but even they would have to admit that it's quite approachable and easy to reason about.

The main project is a JavaScript library, but in the world of open source the more success you have, the more ports you get.

VerbalExpressions has been ported to so many other languages that a GitHub organization was created just to host them all. I think this idea struck a real nerve.

Article links:
English: Stop writing Regular Expressions. Express them with Verbal Expressions.
Russian: Хватит писать регулярные выражения. Используйте вербальные выражения
GitHub C++ variant of lib: https://github.com/VerbalExpressions/CppVerbalExpressions


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Interesting Idea: Stop writing Regular Expressions. Express them with Verbal Expressions. [message #45028 is a reply to message #45027] Fri, 21 August 2015 23:02 Go to previous message
koldo is currently offline  koldo
Messages: 3378
Registered: August 2008
Senior Veteran
It seems interesting. Regular Expressions always were rather complex for me. Maybe they are richer, but for the great majority of times they are not so intuitive.

Best regards
Iñaki
Previous Topic: Looking for windows compiler possibilities
Next Topic: Proposal: optional int64 size/indexes
Goto Forum:
  


Current Time: Thu Jul 25 14:37:30 CEST 2024

Total time taken to generate the page: 0.01241 seconds