Поделиться через


Introduction to Regular Expressions

These topics introduce the concept of regular expressions and explain how to create and use them in JScript.

A regular expression describes one or more strings to match when you search a body of text. The expression serves as character pattern to compare with the text being searched. You can use regular expressions to search for patterns in a string, replace text, and extract substrings.

In This Section

  • Uses for Regular Expressions
    Illustrates circumstances that would benefit from the use of regular expressions.

  • Creating a Regular Expression
    Explains how to construct a regular expression.

  • Regular Expression Programming
    Provides code examples that show how to search for patterns in a string, replace text, and extract substrings.

  • Regular Expression Syntax
    Summarizes the elements that make up the regular expression syntax and provides examples.

  • Lists of Matching Characters
    Describes how to match a single character from a list of characters or range of characters.

  • Quantifiers in JScript
    Explains how to search for a character or set of characters that is repeated a specific number of times.

  • Anchors
    Explains how to specify that a pattern that you are searching for has to appear either at the start or end of the searched string, or the start or end of a line or word in the searched string.

  • Alternation and Subexpressions
    Explains how to specify a choice between two or more alternatives. Also explains how to create a subexpression.

  • Backreferences in JScript
    Explains how to refer to a subexpression from within a regular expression, and from within a replacement string.

  • .NET Framework Regular Expressions
    Clarifies how pattern-matching notation of regular expressions enables developers to quickly search large amounts of text to find specific character patterns; to extract, edit, replace, or delete text substrings; or to add extracted strings to a collection to generate a report.

  • Regular Expression Examples
    Provides a list of links to code examples that illustrate the use of regular expressions in common applications.