fork(2) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. namespace RegExApplication
  5. {
  6. public class Program
  7. {
  8. public static void Main(string[] args)
  9. {
  10. string input = "word1 abcdkl word2";
  11. Regex regex = new Regex(@"^(?=.*\bword1\b)(?=.*\bword2\b).*$");
  12.  
  13. Match match = regex.Match(input);
  14.  
  15. if (match.Success)
  16. {
  17. Console.WriteLine(match.Groups[0].Value);
  18. }
  19. }
  20. }
  21. }
Success #stdin #stdout 0.1s 24520KB
stdin
Standard input is empty
stdout
word1 abcdkl word2