text: Q:
  
  Remove one word and one word before match
  
  One word before match could be a set of any symbols.. like "D.E,F/".
  I have a regex:
  @"\s*[\w/]+\s+XXX"
  
  Input example: This is KKK M.D,D/ xXx PPP
  Output example: This is KKK PPP
  So I need to remove 1 word before XXX also remove XXX (ignoring case).
  
  A:
  
  Note that D.E,F/ is not a word, it is a sequence of non-whitespace chars. [\w/]+ is a character class matching word and / chars, and if you plan to further add chars here, the pattern might get too long and cumbersome.
  It seems more convenient to use the \S+ pattern to match any 1+ chars other than whitespace:
  \s*\S+\s+XXX
  
  See the regex demo. Use RegexOptions.IgnoreCase to perform a case insensitive match, or prepend the pattern with (?i) inline modifier.
  In C#:
  var result = Regex.Replace(s, @"(?i)\s*\S+\s+XXX", string.Empty);
  
  Pattern details
  
  (?i) - a case insensitive inline modifier
  \s* - 0+ whitespace chars
  \S+ - 1+ non-whitespace chars
  \s+ - 1+ whitespace chars
  XXX - an XXX substring.
  
  