4 ms·
The regex shell is a neat idea. In many situations I'd like to generate strings accepted by the regex, to check that my regex is tight enough. I know this is
by mturmon 15y ago
The regex shell is a neat idea.
In many situations I'd like to generate strings accepted by the regex, to check that my regex is tight enough.
I know this is hard in general (for lots of reasons, basically all reducing to "there are a lot of strings and no easy way to iterate through them in a satisfying way").
But, has anyone made any progress on this for the "easy" cases?
- zedshaw 15y agoI thought about trying but it's hard to dip into the regex data structure (if there is one) and also display it in some sort of meaningful way. Other than that, Regetron is kind of just enough of a tool to get you through the book and have no friction. I think for more advanced regex exploration there's http://kodos.sourceforge.net/ http://kodos.sourceforge.net/ and I believe there's a few javascript ones in the browser and even a few very advanced ones in Java.
- tbrooks 15y agoI'm sure this has made the rounds before: http://rubular.com/ http://rubular.com/
- scorpion032 15y agoYour wish has been granted: http://txt2re.com/ http://txt2re.com/ I use this all the time. No wonder I don't know to hand write a Regex.
- haraball 15y agoHere's another tool I use when testing my regex: http://regexpal.com/ http://regexpal.com/ Nice tool for testing the regex on a given data set.
- mturmon 15y agoThat's a neat page, which does help construction of regex's. But, it does not address the question I posed. The regex R generates a language L of strings accepted by R. I want a facility for generating example elements of L. Given that L often is infinite or has immense cardinality, this is hard to do. I think I want a breadth-first descent of the tokens in the regex, but it's not always that simple.