- VB.Net Basic Tutorial
- VB.Net - Home
- VB.Net - Overview
- VB.Net - Environment Setup
- VB.Net - Program Structure
- VB.Net - Basic Syntax
- VB.Net - Data Types
- VB.Net - Variables
- VB.Net - Constants
- VB.Net - Modifiers
- VB.Net - Statements
- VB.Net - Directives
- VB.Net - Operators
- VB.Net - Decision Making
- VB.Net - Loops
- VB.Net - Strings
- VB.Net - Date & Time
- VB.Net - Arrays
- VB.Net - Collections
- VB.Net - Functions
- VB.Net - Subs
- VB.Net - Classes & Objects
- VB.Net - Exception Handling
- VB.Net - File Handling
- VB.Net - Basic Controls
- VB.Net - Dialog Boxes
- VB.Net - Advanced Forms
- VB.Net - Event Handling
- VB.Net Advanced Tutorial
- VB.Net - Regular Expressions
- VB.Net - Database Access
- VB.Net - Excel Sheet
- VB.Net - Send Email
- VB.Net - XML Processing
- VB.Net - Web Programming
- VB.Net Useful Resources
- VB.Net - Quick Guide
- VB.Net - Useful Resources
- VB.Net - Discussion
VB.Net - Grouping Constructs
Grouping constructs delineate sub-expressions of a regular expression and capture substrings of an input string. The following table lists the grouping constructs −
Grouping construct | Description | Pattern | Matches |
---|---|---|---|
( subexpression ) | Captures the matched subexpression and assigns it a zero-based ordinal number. | (\w)\1 | "ee" in "deep" |
(?< name >subexpression) | Captures the matched subexpression into a named group. | (?< double>\w)\k< double> | "ee" in "deep" |
(?< name1 -name2 >subexpression) | Defines a balancing group definition. | (((?'Open'\()[^\(\)]*)+((?'Close-Open'\))[^\(\)]*)+)*(?(Open)(?!))$ | "((1-3)*(3-1))" in "3+2^((1-3)*(3-1))" |
(?: subexpression) | Defines a noncapturing group. | Write(?:Line)? | "WriteLine" in "Console.WriteLine()" |
(?imnsx-imnsx:subexpression) | Applies or disables the specified options within subexpression. | A\d{2}(?i:\w+)\b | "A12xl", "A12XL" in "A12xl A12XL a12xl" |
(?= subexpression) | Zero-width positive lookahead assertion. | \w+(?=\.) | "is", "ran", and "out" in "He is. The dog ran. The sun is out." |
(?! subexpression) | Zero-width negative lookahead assertion. | \b(?!un)\w+\b | "sure", "used" in "unsure sure unity used" |
(?< =subexpression) | Zero-width positive lookbehind assertion. | (?< =19)\d{2}\b | "51", "03" in "1851 1999 1950 1905 2003" |
(?< ! subexpression) | Zero-width negative lookbehind assertion. | (?< !19)\d{2}\b | "ends", "ender" in "end sends endure lender" |
(?> subexpression) | Nonbacktracking (or "greedy") subexpression. | [13579](?>A+B+) | "1ABB", "3ABB", and "5AB" in "1ABB 3ABBC 5AB 5AC" |
vb.net_regular_expressions.htm
Advertisements