Method

Match

Searches the string for the first occurrence of the specified regular expression.

  • pattern: The regular expression pattern to match.
    s.Match("(?<=<title>)[\\d\\D].*?(?=</title>)")
    

Matches

Searches the string for the all occurrences of the specified regular expression.

  • pattern: The regular expression pattern to match.
    s.Matches("(?<=<title>)[\\d\\D].*?(?=</title>)")
    

Match

Searches the string for the first occurrence of the specified regular expression.

  • left: left string
  • right: right string
    s.Match("<nav role=\"navigation\">", "</nav>")
    

Matches

Searches the string for the all occurrences of the specified regular expression.

  • left: left string
  • right: right string
    s.Matches("<nav role=\"navigation\">", "</nav>")
    

IsMatch

Indicates whether the specified regular expression finds a match in the string, using the specified matching options.

  • pattern: The regular expression pattern to match.
    s.IsMatch("(?<=<title>)[\\d\\D].*?(?=</title>)")
    

RegReplace

In a string, replaces all strings that match a specified regular expression with a specified replacement string. Specified options modify the matching operation.

  • pattern: The regular expression pattern to match.
  • replacement: The replacement string.
    s.RegReplace("<title>[\\d\\D].*?</title>","This is a New Title")
    

RegReplace

In a string, replaces all strings that match a specified regular expression with a string returned by a System.Text.RegularExpressions.MatchEvaluator delegate. Specified options modify the matching operation.

  • pattern: The regular expression pattern to match.
  • evaluator: A custom method that examines each match and returns either the original matched string or a replacement string.
    s.RegReplace("(?<=<title>)[\\d\\D].*?(?=</title>)",
                  match=> {
                      return match.Value+ " append suffix";
                  })