Are there any regex builders that work with natural language inputs?
RegExr: Learn, Build and Test Regex
31–40 of 52 posts
Re: RegExr: Learn, Build and Test Regex
#32Re: RegExr: Learn, Build and Test Regex
#33I (and most people I talk to about this stuff) tend to use Regex101 ( https://regex101.com ) for this purpose. It will be interesting to spend some time with RegExr and compare the two tools. I am also aware of RegexBuddy ( https://www.regular-expressions.info/regexbuddy.html ), whose author also publishes very good regex learning content on their site. It looks great, but it's a closed-source Windows-only applicatio…
Why does it matter if it's closed source?
I am a paying customer of RegexBuddy. Best $39 I've ever spent on software.
RegexBuddy's `debug` feature has no equal in open-source or commercial software: https://www.regexbuddy.com/debug.html
It has many more features than regex101 AND it keeps all data local. Maybe regex101 keeps things locally too, but I have to run it in a browser and I'm not about to put sensitive test data there.
That being said, regex101 is very well done, but I paid $39 for RegexBuddy 14 years ago (and price is still the same) and last year paid $19 for the optional upgrade from v3 to v4...but I really only did that to support the developer. v3 still met all my needs.
Re: RegExr: Learn, Build and Test Regex
#34Re: RegExr: Learn, Build and Test Regex
#35Validating regex with some visualization is cool and all...but I actually value my time. I want a WYSIWYG regex builder, not a tool that helps me learn it.
Written by author of RegexBuddy and Oreilly's Regex Cookbook: https://learning.oreilly.com/library/view/regular-expression...
Re: RegExr: Learn, Build and Test Regex
#36I sometimes use https://regexper.com/ to debug hard to understand regexes.
https://www.regexbuddy.com/analyze.html
Or it has the best regex debugger I've ever seen in my 20 year career: https://www.regexbuddy.com/debug.html
Re: RegExr: Learn, Build and Test Regex
#37I think one reason why most people have a hard time reading regex is because they don't use any indentation or linebreaks. Honestly, if a buddy came to you and asked you to help him debug a javascript method and all 15 statements were on the same line, would you offer to help him, or tell him to fix his shit first so you can read it? What if it was all on one line and his variable names were all "v1", "v2", etc. Would you help him then? fuck no. And yet, this is standard operating procedure with regex, except you don't even get "v1", "v2" because nothing is labeled at all. v1/v2/... would be an improvement!
This is how most people write a simple date regex:
\d{1,2}/\d{1,2}/(\d{4}|\d{2})
And mind you, this is a very simple scenario. Here is how you would write it if you treated it like actual code:
(?\d{1,2})
/
(?\d{1,2})
/
(?\d{4}|\d{2})
First off, you can know what my intent is when I'm capturing each group. Maybe this code gets used by a european where the month and day switch places. They can figure out how to fix it in like two seconds. Secondly, the forward slashes are not lost in a sea of characters anymore because we use whitespace like a civilized developer, not a regex savage.
If you want to keep things simple with regular expressions:
* Be liberal with what your pattern matches and use a normal programming language for your complicated conditional logic to filter out crap you don't want
* Don't be afraid to break up the search with multiple regular expressions
* Ignore pattern whitespace and use it to visually break up your pattern. Nobody would agree to debug javascript that has been minimized, yet people do this all the time with regex
* For the love of all that is holy, USE NAMED GROUPS. It is a fantastic way to document your intent.
Re: RegExr: Learn, Build and Test Regex
#38Earlier quoted context omitted.
I typically use Regex101. It's been good enough for my needs and I'm just used to it at this point. Looking at RegExr, it seems like the only big difference is that Regex101 supports substitution, though I think I've only used it once. https://regex101.com/
What do you mean by substitution? Replacing a match with a string/pattern? If so, RegExr does have that tool (at the middle/bottom, tools bar), and it probably is the functionality I most often use.
Re: RegExr: Learn, Build and Test Regex
#39Validating regex with some visualization is cool and all...but I actually value my time. I want a WYSIWYG regex builder, not a tool that helps me learn it.
Oh, you should checkout RegexMagic. That's exactly what it does: https://www.regexmagic.com/ Written by author of RegexBuddy and Oreilly's Regex Cookbook: https://learning.oreilly.com/library/view/regular-expression...
Re: RegExr: Learn, Build and Test Regex
#40I think one reason why most people have a hard time reading regex is because they don't use any indentation or linebreaks. Honestly, if a buddy came to you and asked you to help him debug a javascript method and all 15 statements were on the same line, would you offer to help him, or tell him to fix his shit first so you can read it? What if it was all on one line and his variable names were all "v1", "v2", etc. Woul…