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

135
Views
Remove all letters from a variable except the period?

I am doing some webscraping and trying to filter this variable.

var oldtext = $0.00Amount

var newtext= text.replace(/\D/g, "");

This results in '000' and I need to keep the period.

I know I could write a replace function for each $, A, M, O, U, N, T but is there a smarter way to do that?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

console.log("Price is 1.223$".replace(/[^\d.]/g, ""))

about 4 years ago · Juan Pablo Isaza Report

0

it covers negative values also.

console.log("Price is 1.223$".replace(/[^\d.-]/g, ''));

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!