Skip to content

Instantly share code, notes, and snippets.

@AbraaoAlves
Created July 13, 2015 18:24
Show Gist options
  • Select an option

  • Save AbraaoAlves/6d0ab36b06c3690f851d to your computer and use it in GitHub Desktop.

Select an option

Save AbraaoAlves/6d0ab36b06c3690f851d to your computer and use it in GitHub Desktop.
replace value with regex
var reg = /"IPhone 6": .+;/g;
var str = '{asdasdasd; "IPhone 6": weqweq; "asdasda":"asdasdas"}'
str.match(reg)
//[""IPhone 6": weqweq;"]
var resul = str.match(reg)[0].replace("\"IPhone 6\":", "").replace(";", "")
resul
//" weqweq"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment