I had the older version bookmarked http://gskinner.com/RegExr/ which now redirects to this site. Some other good sites that I've used are: http://regviz.org/ https://regex101.com/ http://osteele.com/tools/rework/ http://www.rexv.org/ https://www.debuggex.com/
RegExr: A website for interactive regex prototyping with syntax highlighting
51–60 of 72 posts
Re: RegExr: A website for interactive regex prototyping with syntax highlighting
#52Re: RegExr: A website for interactive regex prototyping with syntax highlighting
#53Nice work :) Looks like this tool puts the emphasis on the pedagogical aspect. For development, the most fantastic tool that I know of in this space is debuggex. Here is an example with roman numbers: https://www.debuggex.com/r/Xqlv3QcAuw_EgPSM
Re: RegExr: A website for interactive regex prototyping with syntax highlighting
#54RegExr looks really nice, but my go to is still http://rubular.com .
What do you think makes it better? I think the UX on rubular is much cleaner. Don't they both serve a different flavor of regex?
That doesn't make it "better", but it does mean they have slightly different purposes. You can use Ruby specific regex features with Rubular, so it is "better" for Ruby regex development.
As a general principle, I like to test against the same regex engine that I'll use in production. If I'm writing Ruby, I'll use pry/irb or a tool like Rubular. If I'm writing Javascript, you'll find me in the closet with the barrel of a gun in my mouth... I mean, I'll test against my target browsers using their respective web inspector, or use a tool like RegExr.
An example of the differences in the engines, the Onigmo engine supports conditional sub-patterns:
Rubular: http://rubular.com/r/zUwSsIi117
Regexr: http://regexr.com/3b1vn
As far as browsers go, they're actually pretty close most of the time. ECMA specifies regex (I think), so if you stick to the ECMA standard, you should be fairly safe. As with anything in browser-land, you'll encounter edge-case inconsistencies that will bite you in the ass.
Re: RegExr: A website for interactive regex prototyping with syntax highlighting
#55Paste a sample line, mark the parts you like, it generates a piece of code to extract just those parts. Has saved me hours.
Re: RegExr: A website for interactive regex prototyping with syntax highlighting
#56I've been programming for about two decades. I had composed three regexes before my first coffee and before seeing this article this morning. My problem: I still don't have a good mnemonic to remember how magic differs grep, egrep, vim, awk, Perl, Python, etc. If that this site had modes and flavoured cheat-sheets I would live there!
I use RegexBuddy, it has a shitload of different modes.
Re: RegExr: A website for interactive regex prototyping with syntax highlighting
#57Earlier quoted context omitted.
this seems incredibly easy to add given what they're done - just send a note to the author. I can't imagine how it wouldn't take seconds to implement.
It is actually true for PCRE (PHP), Python, and and a bit for non-global Javascript regex. For global matches in JS it is, I dare to say, incredibly difficult, if not impossible. I haven't seen visualised submatches in JS anywhere. I'd be happy to be mistaken and corrected. So go on, try it right away :] I think it might be possible to get it done with breaking original regexp into group tree and look what each part…
Debuggex actually has the /g flag always enabled (the example above happened to have just one match), and it works for JS [1]. Groups for JS are indeed quite tricky. However, they come for free if you implement state visualization, since you need your own regex engine to do that (and can use said engine for the position of groups).
Re: RegExr: A website for interactive regex prototyping with syntax highlighting
#58In the past, when I've looked for a good Internet RegEx test site, I've had trouble finding one that "does" the Java dialect.
Re: RegExr: A website for interactive regex prototyping with syntax highlighting
#59Earlier quoted context omitted.
It is actually true for PCRE (PHP), Python, and and a bit for non-global Javascript regex. For global matches in JS it is, I dare to say, incredibly difficult, if not impossible. I haven't seen visualised submatches in JS anywhere. I'd be happy to be mistaken and corrected. So go on, try it right away :] I think it might be possible to get it done with breaking original regexp into group tree and look what each part…
Author of Debuggex here. Debuggex actually has the /g flag always enabled (the example above happened to have just one match), and it works for JS [1]. Groups for JS are indeed quite tricky. However, they come for free if you implement state visualization, since you need your own regex engine to do that (and can use said engine for the position of groups). [1]: https://www.debuggex.com/r/wSCkdE0_MNrysz4x
I don't know if that behavior for not matching newline matching is desirable since "\s" is supposed to include [ \t\r\n\f]. (See [1]) In any case, there doesn't seem to be an option in debuggex to make it behave like regex101 for my specific example.
Re: RegExr: A website for interactive regex prototyping with syntax highlighting
#60My favourite is still https://regex101.com Example regex: https://regex101.com/r/wY0rM7/1