fork(1) download
  1. import re
  2.  
  3. regex = r"(?<=_(?<!__))[a-zA-Z0-9]+\b"
  4.  
  5. s = ("Calculate the _area of the _perfectRectangle object.\n\n"
  6. "The _id and _age variables are both integers.\n\n"
  7. "__invalidVariable _evenMoreInvalidVariable_ _validVariable")
  8.  
  9. print(re.findall(regex, s))
Success #stdin #stdout 0.03s 9332KB
stdin
Standard input is empty
stdout
['area', 'perfectRectangle', 'id', 'age', 'validVariable']