Search code examples
jsonparsingsublimetext

Regular expression to find in Sublime Text


I need to find all cases in a large json file in a text editor called sublime text

"lsid" : { "id" : UUID("03006811") },

where instead of 03006811 there can be anything. And then replace.

I tried "lsid":\s*{[^}]+}" and some other ways but unsuccessful. Expecting to find all 487 cases with all different values instead 03006811 and then want to replace it.


Solution

  • The following pattern should match "lsid" : { "id" : UUID("03006811") } and it will work for any other alphanumeric value inside the UUID as well

    "lsid"\s*:\s*\{\s*"id"\s*:\s*UUID\("([0-9a-fA-F]+)"\)\s*\}