Easy way to remember Regex operators.

Discussion in 'iOS Programming' started by techwoman, May 7, 2018.

  1. techwoman macrumors newbie

    Nov 22, 2014

    Is there an easy way to remember the regex operators and meta-characters defined in Apple docs? It seems like regex is very useful, but then even after going through apple docs, I hardly understand what the operators and meta-characters stand for.

    Is there a way to learn and keep in mind all the operators?

    Apple docs for regex - https://developer.apple.com/documentation/foundation/nsregularexpression
  2. MC6800 macrumors 6502

    Jun 29, 2016
    Not really... just memorize the basic set, which you'll find in many tutorials. For the rest, keep the reference handy. No point in memorizing them since there are so many variations.
  3. cmaier macrumors G4

    Jul 25, 2007
    Practice, practice, practice.

    The good news is that the same operators used by Apple work pretty much in every other language as well.
  4. Shmanky macrumors regular

    Jul 26, 2005
    You can use a tool like https://regexr.com to test your regular expressions before you use them in your code. A tool like this one, or others, would also have a reference that you can use to pick what you need.

    If someone can recommend a better regular expression tool I would like to hear about it.

Share This Page