KoguNavi

Ruby Regex Tester

Try Ruby-style regular expressions against sample text and inspect matches, indexes, lengths, and capture groups.

Developer tools

What it helps with

  • Check Ruby regex snippets before using them in Rails or scripts
  • Inspect capture groups and match indexes
  • Compare Ruby-style regex behavior with JavaScript regex behavior

How to use

  1. Enter a Ruby-style regular expression pattern.
  2. Paste sample text and choose i / m / x options when needed.
  3. Run the test and review matches, indexes, highlights, and capture groups.

Examples

Ruby anchors

Input

{"pattern":"\\A(?<word>\\w+)","text":"hello\nworld","ignoreCase":false,"dotMatchesNewline":false,"extended":false}

Output

hello

Named captures

Input

{"pattern":"(?<key>\\w+)=(?<value>\\d+)","text":"id=42 count=7","ignoreCase":false,"dotMatchesNewline":false,"extended":false}

Output

id=42, count=7

Dot matches newline

Input

{"pattern":"start.*end","text":"start\nline\nend","ignoreCase":false,"dotMatchesNewline":true,"extended":false}

Output

start\nline\nend

Good to know

  • Uses Oniguruma with Ruby syntax, not a full Ruby runtime.
  • Ruby version and Onigmo differences may still matter for edge cases.
  • Some patterns can be slow in the browser.
  • Shows the first 500 matches.
  • This tool is for testing, not security validation.

FAQ

Is this the same as the JavaScript Regex Tester?
No. This tool uses an Oniguruma engine with Ruby syntax, while the regular Regex Tester uses JavaScript RegExp.
Does it run Ruby code?
No. It only tests regular expression patterns against sample text.
Is it a complete replacement for Ruby itself?
No. It is useful for Ruby-style pattern checks, but Ruby version and Onigmo edge cases can still differ.

Nearby utilities from the KoguNavi toolbox.

Browse all tools