w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Finding all possible substrings within a string. Python Regex

Yes. The regex snippet is: "N[^P][ST]"

Plug it in to any regex module methods from here: http://docs.python.org/2/library/re.html

Explanation:

  • N matches a literal "N".
  • [^P] is a set, where the caret ("^") denotes inverse (so, it matches anything not in the set.
  • [ST] is another set, where it matches either an "S" or a "T".




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.