splitforms.com

Free tool - runs in your browser

Number regex tester: digits, decimals and money formats

Test digits, signed integers, decimals, money, thousands separators and numbers from 1 to 100. Pick a preset, edit the regex and paste numbers one per line. Copy JavaScript, Python or an HTML pattern when you are ready.

One or more ASCII digits; leading zeros are allowed.

3 of 6 match

  • Match0
  • Match123
  • Match001
  • No match-1
  • No match1.2
  • No match1,000

HTML pattern uses the v flag and applies to text inputs, not type=number. Validate again on the server; Python snippets use ASCII matching to keep digit ranges consistent with JavaScript.

Number regex patterns

Choose a format for your input. Default pattern: ^[0-9]+$. Each preset includes matching and non-matching examples.

PresetRegexMatch / no match examplesNotes
Digits only^[0-9]+$Match: 0, 123, 001
No match: -1, 1.2, 1,000; empty string
One or more ASCII digits; leading zeros are allowed.
Integer with optional sign^[+\-]?[0-9]+$Match: 0, +42, -42, 001
No match: +, 1.2, 1,000; empty string
ASCII digits with an optional plus or minus sign.
Decimal with optional sign^[+\-]?(?:[0-9]+(?:\.[0-9]+)?|\.[0-9]+)$Match: 12, -12.5, +.5, 0.25
No match: ., 12., 1,000; empty string
Allows integers and decimals, including a leading decimal point; requires digits after the point.
Money with two decimal places^[0-9]+(?:\.[0-9]{2})?$Match: 0, 12, 12.00, 001.25
No match: -12.00, 12.5, 12.345, $12.00; empty string
Non-negative amounts with either no decimal point or exactly two decimal places; no currency symbol.
Thousands separators^[0-9]{1,3}(?:,[0-9]{3})*(?:\.[0-9]+)?$Match: 1, 123, 1,000, 12,345.67
No match: 1000, 1,00, -1,000, 1,000.; empty string
Groups after a comma must contain three digits. Numbers over three digits require commas.
Range 1-100^(?:100|[1-9][0-9]?)$Match: 1, 9, 10, 99, 100
No match: 0, 01, 101, -1; empty string
Whole numbers from 1 through 100, without leading zeros or a sign.

Number regex in HTML forms

number.html

<label for="number-text">Digits</label>
<input id="number-text" name="number" type="text" inputmode="numeric" pattern="[0-9]+" required>

A text input can enforce a format with the pattern attribute. HTML matches the entire value using the v flag; add required to reject an empty value. For numeric quantities, type=number supports min, max and step instead of pattern. Validate submitted values on the server.

Number regex FAQ

What regex matches only numbers?

Use ^[0-9]+$ to match one or more ASCII digits. It rejects signs, decimal points, commas and an empty string.

How do I allow decimals?

Choose the decimal preset to allow an optional sign and digits with an optional decimal fraction, or a leading decimal point followed by digits. A trailing decimal point alone is rejected.

Should I use input type=number or a pattern with inputmode=numeric?

Use type=number for numeric values with native min, max and step constraints; pattern does not apply to it. Use type=text with inputmode=numeric and pattern when the exact digit format matters, such as an identifier. Validate on the server too.

How do I match numbers with commas?

The thousands preset accepts groups of three digits after each comma, such as 12,345.67. It rejects malformed groups and unseparated numbers with more than three integer digits.

How do I allow negative numbers?

Choose the signed integer or decimal preset. Each accepts an optional minus or plus sign; the money and thousands presets accept non-negative values only.

More free form tools

Form backend cost calculator

Enter monthly submissions and compare the cheapest listed plan across eight form backends.

Email deliverability checker

Enter a domain to check its SPF, DMARC and MX records and get a plain-English fix for each.

SPF record checker

Look up a domain's SPF record, see each mechanism explained and count DNS lookups against the 10-lookup limit.

DMARC record generator

Pick a policy and report address and copy a ready _dmarc TXT record.

DMARC checker

Look up a domain's DMARC record and see the policy and every tag explained.

DKIM record checker

Enter a domain and selector to check its DKIM key, with presets for common senders.

SPF record generator

Tick your email providers and copy one SPF TXT record with a lookup count.

Contact form spam checker

Paste form HTML to audit its honeypot, endpoint, CAPTCHA markers and spam resistance.

Honeypot field generator

Generate a hidden anti-spam input with your chosen name and hiding technique.

Form action URL tester

Check a form action URL for reachability, CORS headers, POST acceptance and backend.

Email obfuscator

Encode your email so spam scrapers can't read it but people can still click it.

Mailto link generator

Build a mailto: URL with recipients, CC, BCC, subject and a pre-filled body.

HMAC-SHA256 generator

Generate and verify webhook signatures for common providers in your browser.

URL encoder and decoder

Encode text, build an x-www-form-urlencoded body or parse a query string.

UTM builder

Build campaign URLs with UTM parameters, tag a CSV in bulk and check tagged links.

HTML to JSX converter

Paste HTML and get JSX or a working React/Next.js form component.

Image to Base64 converter

Convert images to Base64 data URLs in your browser and copy HTML and CSS snippets.

Base64 to image converter

Paste a Base64 data URI to preview and download the decoded image.

Base64 decode & encode

Decode Base64 to readable UTF-8 text or encode text to Base64, locally in your browser.

URL to Base64 converter

Fetch a direct image URL in your browser and get its Base64 data URL.

AI form generator

Describe your form in plain English and copy working HTML.

See all free tools