PromptBase
Upgrade
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Prompt Details

Model
(r1)
Token size
236
Example input
[Match Rule]: Match US phone numbers that could be formatted as (555) 123-4567, 555-123-4567, 555.123.4567, or 5551234567 — always 10 digits total, with an optional area-code parens, and optional dashes or dots as separators. [Sample Strings]: (555) 123-4567 | 555-123-4567 | 555.123.4567 | 5551234567 | 555-12-4567 | 12345 [Regex Flavor]: JavaScript [Case Sensitivity]: Not applicable, digits only
Example output
No ambiguity flagged — the rule fully specifies the accepted formats and digit count. Pattern: /^(\(\d{3}\)\s?|\d{3}[-.]?)\d{3}[-.]?\d{4}$/ Walkthrough: - (555) 123-4567 — PASS. Matches the (\d{3}\)\s? branch, then 123 + - + 4567. - 555-123-4567 — PASS. Matches the \d{3}[-.]? branch with - separators throughout. - 555.123.4567 — PASS. Same branch with . separators. - 5551234567 — PASS. Separators are optional (?), so bare digits satisfy it. - 555-12-4567 — FAIL, correctly. Only 2 digits in the middle group instead of 3, so it doesn't match \d{3} after the first separator. - 12345 — FAIL, correctly. Only 5 digits total, far short of the required 10. Segment breakdown: - ^ — anchors to the start of the string, so no leading junk is allowed. - (\(\d{3}\)\s?|\d{3}[-.]?) — the area code, either parenthesized with an optional trailing space, or three bare digits with an optional dash/dot. - \d{3}[-.]? — the exchange (middle 3 digits) with an optional separator. - \d{4} — the last 4 digits, no separator expected after these. - $ — anchors to the end, so no trailing junk is allowed. Edge cases not in the samples: 1. "555 123 4567" (space-separated) — this pattern does NOT match it, since only - and . are treated as valid separators, not a bare space. Flag this if space-formatted numbers are expected in real data. 2. "+1-555-123-4567" (with country code) — does NOT match, since the pattern anchors to the start and doesn't account for a +1 prefix. Would need a separate optional country-code group if that's in scope. 3. "555-123-4567 ext 202" — does NOT match as a full-string pattern because of the trailing $ anchor; would need the anchor relaxed (or a \b boundary approach) if extensions must be tolerated.
🐋 DeepSeek

Regex Builder And Explainer

Add to Cart
PromptBase Select
Or get it with Select10 Select prompts/mo — under $2 each
Learn more
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this prompt, you agree to our terms of service
R1
Tested icon
Guide icon
4 examples icon
Free credits icon
Describe a matching rule in plain English plus a few sample strings, and get a tested regex pattern, a pass/fail walkthrough for each sample, a segment-by-segment explanation of what each part of the pattern does, and 2-3 edge cases not in your samples that could trip it up. Asks for clarification on case-sensitivity, whitespace, or anchoring before guessing instead of assuming defaults.
...more
Added 3 weeks ago
Report
Browse Marketplace