3 ms·
Would be ultra-cool if you could propose a "generate a matching sample" button.
by redox_ 13y ago
Would be ultra-cool if you could propose a "generate a matching sample" button.
- Lindrian 13y agoI have thought about this, but in cases where it would be useful, it's impossible to generate a sample match string. For example, creating a match string for /(?:a|[bc])efg?/ is super simple, but for something like: /(ab(?1)*)/ it becomes much harder. Not to mention the performance hit you would see for these more complex expressions. (These are just dummy expressions for illustrative purposes, but I'm sure you get my gist.)
- codexon 13y agoIf there is a modifier with a variable number like ?,+,* you could just repeat it X times. For example if it is ? repeat 1 time, + repeat 2, * repeat 3 etc... If it is |, choose the first or choose randomly.
- joezo 13y agoTake a look at http://fent.github.io/randexp.js/ http://fent.github.io/randexp.js/ if you want something that will do this