All tools

Regex Character Class Builder

Regex

Build a regex character class (a [...] bracket expression) from checkboxes for letters, digits, and whitespace plus custom ranges and literal characters, with optional negation

Assemble a regex character class from checkboxes for lowercase, uppercase, digits, and whitespace, plus your own custom ranges like f-k and literal characters like an underscore or hyphen, with an option to negate the whole set. It handles the fiddly part of hand-writing a character class correctly: escaping a literal hyphen, closing bracket, backslash, or caret so they don't get misread as range syntax or the negation marker. The output is the bracket expression only, drop it into your own regex or paste it into the Regex Tester to try it against real input.

regexbuildercharacter-classdevelopment

How to use Regex Character Class Builder

  • 1.Check the named sets you want (lowercase, uppercase, digits, whitespace), and optionally add custom ranges like "f-k" or literal custom characters like "_-.".
  • 2.Toggle negate if you want the class to match any character NOT in the set, which wraps it as [^...].
  • 3.Copy the generated pattern and drop it directly into your own regex, or paste it into the Regex Tester to confirm it matches what you expect.

Frequently asked questions

Does this test the pattern against any input?
No, it only assembles the character class string. Paste the result into the Regex Tester or your own code to actually run it against text.
How are special characters in my custom characters handled?
Characters that have special meaning inside a bracket expression (], \, ^, and -) are automatically escaped with a backslash so they're treated as literals instead of range or negation syntax.
Can I combine named sets, custom ranges, and custom characters in one class?
Yes, all of them are concatenated into a single bracket expression, so you could build something like [a-z0-5_\-] from lowercase plus a custom range plus two literal characters.
What counts as a valid custom range?
Exactly two characters joined by a hyphen, like "f-k", where the first character's code point is less than or equal to the second's. "k-f" or a three-character range like "abc" are both rejected.

Use via API, SDK, or MCP

cURL# Free: 1,000 req/day · Pro: 10,000 req/day
curl -X POST https://api.utilix.tech/v1/tools/regex-character-class-builder \
  -H "Authorization: Bearer utx_live_..." \
  -H "Content-Type: application/json" \
  -d '{"lowercase":true,"uppercase":true,"digits":true,"whitespace":false,"customRanges":[],"customChars":"_","negate":false}'

Get an API key from your dashboard · Full API docs →