0

I'm trying to parse a former colleague's R code, and it's full of expressions like:

\bso\!so

What is the function of the exclamation point in this code? I suspect it has something to do with some kind of look(ahead|behind|around), but I don't know.

soosus
  • 1,211
  • 4
  • 18
  • 27
  • 3
    In regex, `\!` matches a literal `!` if not part of `(?!...)` or `(?<!...)` lookaround constructs. – Wiktor Stribiżew Aug 16 '17 at 17:44
  • @WiktorStribiżew Can you explain this in a bit more detail? I looked at the other question you cited, and it does not really explain. Why does the expression include both "\bso" and "\b!so"? What is encompassed in a literal ("\b!so") that is not encompassed in a non-literal ("\bso") and why use them in conjunction? – soosus Aug 16 '17 at 17:50
  • See https://regex101.com/r/1NZQbC/1. The linked question provides the link to many regex testers incl. regex101.com where all regexps are explained. – Wiktor Stribiżew Aug 16 '17 at 17:51
  • Thank you! This is very helpful. (Also, this tester is very powerful!) – soosus Aug 16 '17 at 17:56

0 Answers0