geongeorge / i-hate-regex

The code for iHateregex.io 😈 - The Regex Cheat Sheet
https://iHateRegex.io
4.5k stars 320 forks source link

Support for VerbalExpressions? #11

Closed aadrian closed 4 years ago

aadrian commented 4 years ago

Hi,

The diagram rendering of a regexp is very nice and helpful.

Any chance adding support for Verbal Expressions? https://github.com/VerbalExpressions -> they seem to map in "words" very nicely the diagram blocks.

So the idea would be for a regexp like /^(http)(s)?(\:\/\/)(www\.)?([^\ ]*)$/ to also generate besides the diagram the VerbalExpression text alternative:

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

for the desired programming language.

See https://github.com/VerbalExpressions/JSVerbalExpressions#testing-if-we-have-a-valid-url

Thank you.

geongeorge commented 4 years ago

This is something we find unnecessary, Closing it for now