3

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?

2
  • The cheatsheet you linked should do fine for your needs.
    – Adrian Larson
    Aug 31, 2016 at 13:19
  • 2
    regex101.com includes "most used tokens" info and lets you experiment.
    – Keith C
    Aug 31, 2016 at 13:31

2 Answers 2

2

Please see, this Cheat sheet And

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<String> keysInJson = new List<String>();
 while (m.find()) {
     keysInJson.add(m.group(1));
 }

 SYSTEM.DEBUG("Keys in JSON: "+keysInJson);` 

Source: https://salesforce-developer.ru

0
0

I always use GSkinner's Web site which has something along those lines. The definitive docs of course are also available at this link from Oracle.

Not the answer you're looking for? Browse other questions tagged .