I'm guessing the following is either near-impossible or pure-impossible, but: Is there a tool that allows you to highlight portions of a string and generate a corresponding regex? (i.e. the inverse of RegExr)
Here is the problem with that: Consider the string abcdefgh Guess what!? I have the perfect regex to match your string. "abcdefgh" So given a string literal, there is always a regex to match that literal. Namely, the literal itself. Really, what you want is a tool that, given several examples, will generate a regex that matches all of them. So you'd give it: aaaaabaa aabaaa aba abaaaaa And it'd generate "a+ba+" The p…
RegExr 2.0
41–47 of 47 posts
Re: RegExr 2.0
#42Regex testing is cool, but there are dozens of these kinds of tools and I'd really love to see some other kinds of regex tools - A list generator. Enter a regex, set repetition operator constraints (e.g. ->{0,3}, +->{1,3}, .->[A-Z0-9 ], etc.) and have it exhaustively generate a list of matching strings. This is helpful when you have a regex that matches your test strings, but also to let you know what else* it'll mat…
I've generated some very massive regex's that are quite speedy.
Merger
https://metacpan.org/pod/Regexp::Assemble
These are also super handy https://metacpan.org/pod/Number::Range::Regex
https://metacpan.org/pod/Regexp::CommonRe: RegExr 2.0
#43Regex testing is cool, but there are dozens of these kinds of tools and I'd really love to see some other kinds of regex tools - A list generator. Enter a regex, set repetition operator constraints (e.g. ->{0,3}, +->{1,3}, .->[A-Z0-9 ], etc.) and have it exhaustively generate a list of matching strings. This is helpful when you have a regex that matches your test strings, but also to let you know what else* it'll mat…
I actually do the combining idea all the time. As long as the language is roughly pcre compatible you can use this to spit out your regex and (if necessary for your alternate language tweak it a bit so it fits). I've generated some very massive regex's that are quite speedy. Merger https://metacpan.org/pod/Regexp::Assemble These are also super handy https://metacpan.org/pod/Number::Range::Regex https://metacpan.org/p…
Re: RegExr 2.0
#44I'm guessing the following is either near-impossible or pure-impossible, but: Is there a tool that allows you to highlight portions of a string and generate a corresponding regex? (i.e. the inverse of RegExr)
"aaa" is a valid regex that matches the string "aaa". If you have special characters in your source string, many libraries have a regex for escaping them. So, generating a regex to match your exact string is trivial. Even matching a group of strings is trivial via (aaa|bbb|etc), though it gets long. Given that, what I think you're really asking is, "how do I automatically generate a regex of optimal conciseness given…
Re: RegExr 2.0
#45Earlier quoted context omitted.
Just to make it clear: It does not even support the basic Latin-1 charset correctly. Matching my family-name requires manual intervention. This is sad. It seems a very nice regex page otherwise.
Creator here - can you elaborate? What is your family name? The example in this thread ("Grüneis") matches and displays correctly in all the browsers I've tested. Are you perhaps trying to use a RegEx feature that is not supported by JS? Currently, RegExr only supports the JS flavour of RegEx.
Re: RegExr 2.0
#46Earlier quoted context omitted.
Just to make it clear: It does not even support the basic Latin-1 charset correctly. Matching my family-name requires manual intervention. This is sad. It seems a very nice regex page otherwise.
Creator here - can you elaborate? What is your family name? The example in this thread ("Grüneis") matches and displays correctly in all the browsers I've tested. Are you perhaps trying to use a RegEx feature that is not supported by JS? Currently, RegExr only supports the JS flavour of RegEx.
Re: RegExr 2.0
#47Why can I not match against "\w*" for instance? It just says "infinite" and does not seem to attempt to match.
Creator here - this is because \w* matches 0 characters, and thus matches infinitely. You can roll over the "infinite" error for details, or look in the help. Try \w+ instead.