skip to Main Content

Regex to remove Key/Value in a JSON Object

I have a JSON like below: {"queueNumber": "123","field":"name",UserId":[12,12,34],"cur":[{"objectName":"test","uniqueNumber":"123456"}]} I want to remove the key-value pairs if it matches key or value matches the given field. I am using the below regex.It is not removing the key if the type of…

VIEW QUESTION

JavaScript regex to standardize US zipcode

I can't figure out whats what with a regex. The simplest reproduction is this failed match where I would expect that 3rd capture group to be 'A'.: > console.log('00000-0000A'.match(/(D)s*(d{5}-d{4})s*(D)/g)); null undefined Additional context includes: const standardizeZipcode = (str: string) =>…

VIEW QUESTION
Back To Top
Search