fork(3) 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 abc = "Nursing_Desk";
  11. string input = "C:\\Nova6\\Nursing_Desk\bin\\Debug";
  12. string pattern = "^(.*?)(?=\\\\" + abc + ")";
  13. Console.WriteLine(pattern);
  14. Regex rgx = new Regex(pattern);
  15.  
  16. Match match = rgx.Match(input);
  17.  
  18. if (match.Success)
  19. {
  20. Console.WriteLine(match.Groups[1].Value);
  21. }
  22. }
  23. }
  24. }
Success #stdin #stdout 0.12s 24688KB
stdin
Standard input is empty
stdout
^(.*?)(?=\\Nursing_Desk)
C:\Nova6