.Net Regex builder

.Net Regex builder:

Use verbatim literal string (@"") Use literal code string ("") Use raw string (for editor search)

Build and test regular expressions using .Net's powerful Regular expression engine.

Note: This is not an emulator (like some regex testers on the web). It directly calls the server's .Net Regular expression engine (Currently .Net 6). What you see is what you get.

The page supports testing Matches, Split and Replace.

The results are shown in easy to understand tables showing all matches, all groups and captures.

Enter regular expression in code string format (like you would in code).

Supports setting all .Net Regex options.

Syntax errors will be reported as you type. When errors have been fixed a Regex construtor will be shown, ready to copy/paste.

The syntax you use depends on the string format, you have chosen (the tabs).

You can choose between literal verbatim string format and normal literal string format. Switching between them will convert the regular expression to that format.

Regex string format:

  1. Literal verbatim string (@"")

    : Here you don't need to double escape control characters, example '\n' matches a newline.
    Doublequotes must be doubled, example ''""'' matches one doublequote.
  2. Literal code string ("")

    : Here you need to double escape all control characters, example '\\n' matches a newline.
    Doublequotes must be escaped, example '\"' matches one doublequote.
  3. Raw string (for editor search)

    : Here you use the raw regex string - without any escapes.
    This is suitable for direct input in your editors search box.

The 'Regex constructor' will show the Regex constructor based on your Regex and options, ready to copy and paste into your code.
Switching to the other string type (by clicking the tabs) will also change the constructor to that format.

When you have tested your RegExp, you can save it and share the link.