skip to Main Content

Converting Regex from JS to PHP

I have a code in JS that does the following check based on regex rules as below: let nameCriteria = { uppercase: {regex: /[A-Z]/, description: 'At least one uppercase letter'}, lowercase: {regex: /[a-z]/, description: 'At least one lowercase letter'}, digit:…

VIEW QUESTION

Javascript – Ignoring decimals when formatting

I'm trying to write the regex that will format the number like 1231231.00 to 1,231,231.00. I've written something like this: let test = "1231231.00"; console.log(test.replace(/(d)(?=(d{3})+$)/g, "$1,")) But I still have problem when I try to format 1231231.00. Can anyone give…

VIEW QUESTION
Back To Top
Search