Skip to content

Instantly share code, notes, and snippets.

@wilnaweb
Created February 16, 2023 13:58
Show Gist options
  • Save wilnaweb/9ed539b25b7dd0bdae1de473cef74cc3 to your computer and use it in GitHub Desktop.
Save wilnaweb/9ed539b25b7dd0bdae1de473cef74cc3 to your computer and use it in GitHub Desktop.
RegExp search JSON by key within prefix
var regexp = /(?:\"PRE-)(.*?)(?:\":)(?:\")(.*?)(?:\")/gi;
var json = '{
"KEY 1":"VALUE",
"KEY 2":"VALUE",
"PRE-KEY3":"VALUE",
"KEY 10":"VALUE",
"PRE-KEY4":"TEST"
}';
// Example: https://regexr.com/78d0r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment