fork download
  1. using System;
  2. using System.Linq;
  3. using System.Text.RegularExpressions;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. var wordOrPhrase = "acknowledg him regard the invest";
  10. var rx = string.Join(" +",
  11. wordOrPhrase.Split().Select(p => string.Format(@"\b{0}\w*\b", Regex.Escape(p))));
  12. Console.WriteLine(rx);
  13. Console.WriteLine(Regex.IsMatch("acknowledging him regarding the investment", rx));
  14. }
  15. }
Success #stdin #stdout 0.12s 24528KB
stdin
Standard input is empty
stdout
\backnowledg\w*\b +\bhim\w*\b +\bregard\w*\b +\bthe\w*\b +\binvest\w*\b
True