5 ms·
I 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 /(
by Lindrian 13y ago
I 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.