C#: Regular Expressions Cheat Sheet

The Regex Class

public bool IsMatch(string input)Indicates whether the regular expression specified in the Regex constructor finds a match in a specified input string.
public bool IsMatch(string input, int startat)Indicates whether the regular expression specified in the Regex constructor finds a match in the specified input string, beginning at the specified starting position in the string.
public static bool IsMatch(string input, string pattern)Indicates whether the specified regular expression finds a match in the specified input string.
public MatchCollection Matches(string input)Searches the specified input string for all occurrences of a regular expression.
public string Replace(string input, string replacement)In a specified input string, replaces all strings that match a regular expression pattern with a specified replacement string.
public string[] Split(string input)Splits an input string into an array of substrings at the positions defined by a regular expression pattern specified in the Regex constructor.

Leave a Reply

Your email address will not be published. Required fields are marked *