yv-9dq
Last Updated: February 25, 2016
·
552
· ashiguruma

RegEx to replace function with it's argument

Sometimes JSON output can contain values that are functions. The best way to overcome this is to actually export the data properly so it's actually JSON. Should that not be possible, this regex will help you replace things like:

{"dateCreated": ISODate("2013-07-19T15:32:56.049Z")}

with

{"dateCreated": "2013-07-19T15:32:56.049Z"}

In your text editor find this:

function_name[^(]*\(([^)]*)\)

Replace this:

$1

NB: This doesn't work for multiple arguments

Awesome Job

Frontend Web Developer for Games
·
Leamington Spa (United Kingdom)
·
Full Time