TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

RegExr 2.0

106 pointsby _kushagraabout 11 years ago

11 comments

baneabout 11 years ago
Regex testing is cool, but there are dozens of these kinds of tools and I&#x27;d really love to see some other kinds of regex tools<p>- A list generator. Enter a regex, set repetition operator constraints (e.g. <i>-&gt;{0,3}, +-&gt;{1,3}, .-&gt;[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 </i>else* it&#x27;ll match. The constraints are to keep it from generating infinite lists. Even if it jams out tens or hundreds of thousands of produced strings, it&#x27;s still useful. I&#x27;ve found that most people just build up the first regex that will &quot;match&quot; their input text, and move on without thinking about all the edge cases they&#x27;ve just introduced.<p>- A regex assembler optimizer. Give it a few regexes, have it assemble them into one large regex and optimize it. It&#x27;s got to do better than just | or&#x27;ing all the regexes together. I&#x27;ve seen some work done on using trie variants to do this, but have no idea how far along the work is on this.<p>- A regex list generator. Give it a list of strings you want to match and have it generate a regex. A sliding &quot;fuzziness&quot; control could tell it to take alternates in the same character position and substitute either<p>1. Just the characters in the given list - a, t and q in the same position generates a|t|q<p>2. A representative narrow character range - if I give it a|t|q it knows to use [A-Z] while a|t|q|4 might generate [A-Z0-9]<p>3. A larger character range, a|t|q might just go ahead and produce [A-Z0-9]<p>4. An even larger character range, whatever it is, just use .<p>And maybe another slider for repetitions, so if I end up with [A-Z][A-Z][A-Z], should it just produce [A-Z]{3} or can I go ahead and have it [A-Z]+<p>Jam the result through an optimizer (see previous idea above) to clean up the regex and maybe even run it through the list generator to check if it produces only what you want.
评论 #7537855 未加载
评论 #7538781 未加载
评论 #7538024 未加载
评论 #7538040 未加载
评论 #7537600 未加载
lelfabout 11 years ago
People just cannot do unicode even remotely properly. Just cannot.<p>𝄞 is one char, not two. привет is matched by \w+.<p>PS there&#x27;s some advanced stuff but where is basic [[:posix:]] char classes?
评论 #7537387 未加载
评论 #7537310 未加载
评论 #7538527 未加载
shockabout 11 years ago
&gt; Uh-oh, it looks like your browser is not supported.<p>&gt; RegExr only supports modern desktop browsers.<p>I&#x27;m using Firefox 30 on Ubuntu. I think it&#x27;s plenty modern :)
评论 #7537261 未加载
评论 #7537815 未加载
评论 #7537244 未加载
markbnjabout 11 years ago
Very nicely done. As someone else pointed out there are quite a few of these tools, but I think you&#x27;ve done a really nice job with this one. One suggestion: make the reference easier to scan at a top level as opposed to drilling down.
nlhabout 11 years ago
I&#x27;m guessing the following is either near-impossible or pure-impossible, but:<p>Is there a tool that allows you to highlight portions of a string and generate a corresponding regex? (i.e. the inverse of RegExr)
评论 #7537324 未加载
评论 #7537314 未加载
评论 #7537307 未加载
评论 #7537311 未加载
评论 #7537298 未加载
ChrisGaudreauabout 11 years ago
Reminds me of <a href="http://rubular.com/" rel="nofollow">http:&#x2F;&#x2F;rubular.com&#x2F;</a>, except it isn&#x27;t Ruby-focused and is more community-based. Seems pretty cool.
评论 #7537383 未加载
评论 #7537559 未加载
mck-about 11 years ago
There is one for Javascript that I use pretty often: <a href="http://scriptular.com/" rel="nofollow">http:&#x2F;&#x2F;scriptular.com&#x2F;</a> (based on the Ruby one: <a href="http://www.rubular.com/" rel="nofollow">http:&#x2F;&#x2F;www.rubular.com&#x2F;</a>)
cygniabout 11 years ago
<a href="https://www.debuggex.com/" rel="nofollow">https:&#x2F;&#x2F;www.debuggex.com&#x2F;</a> is a nice alternative that is a little different from other regex sites I&#x27;ve seen.
strictfpabout 11 years ago
Why can I not match against &quot;\w*&quot; for instance? It just says &quot;infinite&quot; and does not seem to attempt to match.
评论 #7538505 未加载
hardwaresoftonabout 11 years ago
one of the best regular expression testers online just got better. Great site, love it
tuananhabout 11 years ago
a side note: i found Patterns app on OS X very useful for regex.