0

In some languages or commands (eg: javascript) I can use \d, \w

In others I have to use [0-9], [a-zA-Z]

How to tell when I can use \d, \w?

[A side question: can Notepad++ and grep use them?]

Ksthawma
  • 1,257
  • 1
  • 16
  • 28

2 Answers2

2

Simple answer - RTFM for each language/function what kind of RegExp they support, as there are different dialects, at least (I really don't remember all differences, have to read manual each time for new function):

  1. Perl Compatible
  2. Posix
  3. GNU

And of course not all languages fully supports any kind of standard, so after reading common manual you have to struggle with peculiarities of particular implementation

Iłya Bursov
  • 23,342
  • 4
  • 33
  • 57
1

Look up a reference for the language you're using the regexes in or try them out; we can't give an exhaustive reference here.

Notepad++ does have regex support, but I've found it to be flaky. It's supposed to support the basic character classes, though. Grep, I'm less familiar with. I'd expect it to, but...try and see.

Josh
  • 1,563
  • 11
  • 16