fork(1) download
  1. import re
  2. regexPattern = '(?s)^(?!.*(?:word1|word2|word3)).*$'
  3. mytext= 'jsdjsqd word1dsqsqsword2fjsdjswrod3sqdq'
  4. print(re.sub(regexPattern, "P", mytext))
Success #stdin #stdout 0.01s 9016KB
stdin
Standard input is empty
stdout
jsdjsqd word1dsqsqsword2fjsdjswrod3sqdq