Hacker News new | past | comments | ask | show | jobs | submit login

Rubular uses Ruby's regex engine (Oniguruma/Onigmo). Regexr uses your browser's RegEx engine.

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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: