Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can test I regular expressions using multiple RE engines? [closed]

Tags:

regex

testing

People also ask

How do you test expressions in regex?

To test a regular expression, first search for errors such as non-escaped characters or unbalanced parentheses. Then test it against various input strings to ensure it accepts correct strings and regex wrong ones. A regex tester tool is a great tool that does all of this.

What is the use of test () in regular expression?

test() The test() method executes a search for a match between a regular expression and a specified string.

What are the three main uses of regular expressions?

The three basic operations in which regular expressions are used are: matching (Does this (entire) string match this pattern?) searching (Is this pattern found within this string?) transforming (such as replacing one or all occurrences of a pattern with another string)

Which function is used to match a regular expression?

match() function of re in Python will search the regular expression pattern and return the first occurrence. The Python RegEx Match method checks for a match only at the beginning of the string. So, if a match is found in the first line, it returns the match object.


The most powerful free online regexp testing tool is by far http://regex101.com/ - lets you select the RE engine (PCRE, JavaScript, Python), has a debugger, colorizes the matches, explains the regexp on the fly, can create permalinks to the regex playground.

Other online tools:

  • http://www.rexv.org/ - supports PHP and Perl PCRE, Posix, Python, JavaScript, and Node.js
  • http://refiddle.com/ - Inspired by jsfiddle, but for regular expressions. Supports JavaScript, Ruby and .NET expressions.
  • http://regexpal.com/ - powered by the XRegExp JavaScript library
  • http://www.rubular.com/ - Ruby-based
  • Perl Regex Tutor - uses PCRE

Windows desktop tools:

  • The Regex Coach - free Windows application
  • RegexBuddy recommended by most, costs US$ 39.95

Jeff Atwood [wrote about regular expressions]( post:).

Other tools recommended by SO users include:

  • http://www.txt2re.com/ Online free tool to generate regular expressions for multiple language (@palmsey another thread)
  • The Added Bytes Regular Expressions Cheat Sheet (@GateKiller another thread)
  • http://regexhero.net/ - The Online .NET Regular Expression Tester. Not free.

RegexBuddy


I use Expresso (www.ultrapico.com). It has a lot of nice features for the developer. The Regulator used to be my favorite, but it hasn't been updated in so long and I constantly ran into crashes with complicated RegExs.


Here are some for the Mac: (Note: don't judge the tools by their websites)

  • RegExhibit - My Favorite, powerful and easy
  • Reggy - Simple and Clean
  • RegexWidget - A Dashboard Widget for quick testing

If you are an Emacs user, the command re-builder lets you type an Emacs regex and shows on the fly the matching strings in the current buffer, with colors to mark groups. It's free as Emacs.