Is there a reliable Regex Document / Cheat sheet? [closed]

I've been looking for some good regex cheatsheet and I can't seem to find one that is like the one I'm looking for. I want something like the cheatsheet found at Regex Cheatsheet Link I'm just beginning to learn regexes in apex but I've had experience with regexes in Python / Java. Are there any good learning tools for apex regexes? If you don't think it's necessary with my experience with regexes would you suggest just trying everything out and writing my own cheatsheet?


Answered by Chris Dyer

If you want get all keys from json, you can use this code:

`string jsonString = '{"CompletedAt":null, "Scaled":null, "Raw":null, "Min":null, "Max":null, "TotalTimeTicks":null, "Location":null, "SuspendData":null}'; Matcher m = Pattern.compile('\"([^"]*)\":').matcher(jsonString); List keysInJson = new List(); while (m.find()) { keysInJson.add(m.group(1)); } SYSTEM.DEBUG("Keys in JSON: "+keysInJson);`

Your Answer

Interviews

Parent Categories