fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8.  
  9. string pattern = @"describe\('[^']*', function \(\) {.*?it\('([^']*)-Expected result-([^']*)',";
  10. string input = @"describe('Criteria and Adjustment Section', function () {
  11. it('the labels should have correct spellings -Expected result- the labels have correct spellings', function () {
  12. //some logic
  13. });
  14.  
  15.  
  16. describe('Test 1', function () {
  17. it('Click on the company dropdown -Expected result- Four options will be shown', function () {
  18. //some logic
  19. });";
  20. RegexOptions options = RegexOptions.Multiline | RegexOptions.Singleline;
  21. int count=0;
  22. foreach (Match m in Regex.Matches(input, pattern, options))
  23. {
  24. ++count;
  25. Console.WriteLine("Test No : "+count);
  26. Console.WriteLine("Test-Cases: "+m.Groups[1].Value);
  27. Console.WriteLine("Expected Reult: "+m.Groups[2].Value);
  28.  
  29. }
  30. }
  31. }
  32.  
Success #stdin #stdout 0.02s 30792KB
stdin
Standard input is empty
stdout
Test No : 1
Test-Cases: the labels should have correct spellings 
Expected Reult:  the labels have correct spellings
Test No : 2
Test-Cases: Click on the company dropdown 
Expected Reult:  Four options will be shown