Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

232
Views
Regex for adding thousand separator WITHOUT decimals?

I need a regular expression for adding a dot as a thousand and millon separator in Javascript. I've searched the whole web without finding the format I need. It would return this:

1
12
123
1.234
12.345
123.456
1.234.567
12.345.678
123.456.789

I'm trying to use it in an input.

  handleIdChange = (personalIdNumber) => {
this.validator.updateField("personalId", {
  number: personalIdNumber
})
this.props.setVisitorField({
  field: "personalId.number",
  value: personalIdNumber
});

            <CLTextInput
            highContrast={true}
            onChangeText={this.handleIdChange}
            keyboardType="numeric"
            placeholder="Número"
            returnKeyType="next"
            autoCapitalize="none"
            autoCorrect={false}
            value={visitor.personalId.number}
            error={this.shouldShowError("personalId")}
            accessibility
            />
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Don't use regular expressions to format numbers. Use a proper number formatter.

If you want german-style number formatting, set that as the locale.

const formatter = new Intl.NumberFormat('de-DE');
for (let i = 0; i < 10; i++) {
    const number = 10 ** i;
    console.log(formatter.format(number));
}

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!