views:

49

answers:

6

Hi,
did anybody know a good regex tester for javascript (i think there are differents between php regex and javascript? right?)

Thanks in advance!
Peter

A: 

There are differences, yes. There can even be slight differences in how regex is implemented between browsers (e.g. IE's "JScript" variant vs. Firefox), surprise surprise.

You should find plenty of JS-oriented regex testing tools on the web though. For example, I've used this one in the past, which is written in Javascript:

http://www.regular-expressions.info/javascriptexample.html

Ben Poole
A: 

Rubular

It's actually for Ruby but it's pretty good for testing most standard regex. It allows lookbehind though which Javascript does not implement.

El Ronnoco
Apologies, it *doesn't* allow lookbehind!
El Ronnoco
A: 

You could try http://regexpal.com/

KennyTM
+1  A: 

Try Rejex, it's a regexp tester for javascript

mck89
+3  A: 

A very good (though not free) regex tester, debugger and converter is RegexBuddy. It's especially handy if you need to convert regular expressions from one flavor to another, and there is a grep tool built in.

RegexBuddy screenshot

Tim Pietzcker
A: 

For a tester, try RegexPal. About differences, there are quite a few. The most importantant ones are:

PHP's preg_* regexes support lookbehind assertions and conditionals, while Javascript regex doesn't. For a more detailed list, visit:

http://www.regular-expressions.info/refflavors.html

Confluence
Javascript's regex do support lookahead.
KennyTM