Examples or regular expressions you can use on WhatsApp Forms

Here are specific, production-ready regular expressions tailored to those exact scenarios, complete with breakdowns of how they function.

1. Car Dealerships: License Plate Validation

License plate formats vary wildly by region, but dealerships usually look for specific patterns depending on their location.

A. European Union Standard (Approximate Format)

Most EU countries use a format of 1 to 3 letters (country/region code), a dash or space, followed by numbers and more letters.

  • The Regex: ^[A-Z]{1,3}[- ]?[A-Z0-9]{1,5}$
  • Matches: M-Y 1234 (Germany), ABC 123

B. Standard US License Plates (Generic 7-Character)

While every US state has unique formats, a generic validation for modern 7-character sequential plates (like California’s 1AAA111 or New York’s AAA1111) looks like this:

  • The Regex: ^[A-Z0-9]{1}[A-Z]{3}[0-9]{3}$|^[A-Z]{3}[0-9]{4}$
  • Matches: 7XYZ999, ABC1234

2. Job Applications: Years of Experience & Portfolio Links

When candidates apply for a job, recruiters need clean data for filtering.

A. Years of Experience (Allows decimals, caps at double digits)

You want to accept 5, 3.5, or 0.5, but reject typos like 100 or letters.

  • The Regex: ^\d{1,2}(\.\d)?$
  • How it works: * \d{1,2} Matches 1 or 2 digits (e.g., 5 or 12).
    • (\.\d)? Optionally allows a decimal point followed by exactly one digit (e.g., .5).
  • Matches: 6, 10.5, 0.5

B. GitHub / LinkedIn Profile URL

To ensure applicants provide a real profile link rather than just typing “yes” or pasting a random link.

  • The Regex: ^https:\/\/(www\.)?(linkedin\.com\/in|github\.com)\/[a-zA-Z0-9_-]+\/?$
  • Matches: https://www.linkedin.com/in/john-doe, https://github.com/janedoe

3. Home Improvement Works: Dimensions & Cost Estimates

Contractors and home improvement platforms need precise measurements (feet/inches) and currency validation.

A. Room Dimensions (Feet and Inches Format)

If a user is entering dimensions for flooring or roofing, they often use standard notation like 12’6″.

  • The Regex: ^\d+\'([0-1]?[0-1]|\d)\”$
  • How it works: * \d+\’ Matches any number of feet followed by a single quote (‘).
    • ([0-1]?[0-1]|\d)\” Restricts the inches part to a number between 0 and 11, followed by a double quote (“).
  • Matches: 10’3″, 12’11”, 5’0″

B. Project Budget / Cost Estimate (Currency Validation)

Validates standard currency inputs, forcing two decimal places if a decimal is used, and making the dollar sign optional.

  • The Regex: ^\$?\d{1,3}(,\d{3})*(\.\d{2})?$
  • Matches: $1,500, 250.00, $12500

🛠️ Implementation Tip: When using these in HTML5 front-end forms, you can drop them directly into the pattern attribute of an <input> tag, like this: <input type=”text” pattern=”^\d+\'([0-1]?[0-1]|\d)\&quot;$” title=”Please enter dimensions in FT’IN&quot; format, e.g., 12’6&quot;”>

Are any of these forms targeting a specific geographic region (like a specific US state’s DMV rules for the license plates), or do you need a breakdown of how one of these specific patterns calculates its match?

Leave a comment