Advertisement
Guest User

Untitled

a guest
Mar 5th, 2019
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. string input = @"""abc"" <abc@gmail.com>; ""pqr"" <pqr@gmail.com>;";
  2. var output = String.Join(";", Regex.Matches(input, @"<(.+?)>")
  3. .Cast<Match>()
  4. .Select(m => m.Groups[1].Value));
  5.  
  6. var regex = new Regex(@"<(.*?)>");
  7. var input= @"""abc"" <abc@gmail.com>; ""pqr"" <pqr@gmail.com>";
  8. var matches = regex.Matches(input);
  9. var res = string.Join(";", matches.Cast<Match>().Select(x => x.Value.Replace("<","").Replace(">","")).ToArray());
  10.  
  11. string input = ""abc" <abc@gmail.com>; "pqr" <pqr@gmail.com>;";
  12. matchedValuesConcatenated = string.Join(";",
  13. Regex.Matches(input, @"(?<=<)([^>]+)(?=>)")
  14. .Cast<Match>()
  15. .Select(m => m.Value));
  16.  
  17. string str = ""abc" <abc@gmail.com>; "pqr" <pqr@gmail.com>;";
  18. string output = string.Empty;
  19. while (str != string.Empty)
  20. {
  21. output += str.Substring(str.IndexOf("<") + 1, str.IndexOf(">") -1);
  22. str = str.Substring(str.IndexOf(">") + 2, str.Length - str.IndexOf(">") - 2).Trim();
  23. }
  24.  
  25. private string GetEmailId(string input)
  26. {
  27. int start = input.IndexOf("<");
  28. int end = input.IndexOf(">");
  29. string result = input.Substring(start + 1, end - start - 1);
  30. return result;
  31. }
  32.  
  33. string id = GetEmailId("'abc' <abc@gmail.com>");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement