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?

closed as off-topic by Adrian Larson, Ratan Paul, Mohith Shrivastava, Mark Pond, Sebastian Kessel Aug 31 '16 at 16:04

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – Adrian Larson, Ratan Paul, Mohith Shrivastava, Mark Pond, Sebastian Kessel
If this question can be reworded to fit the rules in the help center, please edit the question.

  • The cheatsheet you linked should do fine for your needs. – Adrian Larson Aug 31 '16 at 13:19
  • 2
    regex101.com includes "most used tokens" info and lets you experiment. – Keith C Aug 31 '16 at 13:31
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

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 or ask your own question.