System [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00] 1.0.3300.0 1.0.5000.0 2.0.0.0 4.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.Text.RegularExpressions.Capture A capturing group can capture zero, one, or more strings in a single match because of quantifiers. (For more information, see Quantifiers.) All the substrings matched by a single capturing group are available from the property. Information about the last substring captured can be accessed directly from the Value and Index properties. (That is, the instance is equivalent to the last item of the collection returned by the property, which reflects the last capture made by the capturing group.) An example helps to clarify this relationship between a object and the that is returned by the property. The regular expression pattern (\b(\w+?)[,:;]?\s?)+[?.!] matches entire sentences. The regular expression is defined as shown in the following table. Pattern Description \b Begin the match at a word boundary. (\w+?) Match one or more word characters, but as few characters as possible. This is the second (inner) capturing group. (The first capturing group includes the \b language element.) [,:;]? Match zero or one occurrence of a comma, colon, or semicolon. \s? Match zero or one occurrence of a white-space character. (\b(\w+?)[,:;]?\s?)+ Match the pattern consisting of a word boundary, one or more word characters, a punctuation symbol, and a white-space character one or more times. This is the first capturing group. [?.!] Match any occurrence of a period, question mark, or exclamation point. In this regular expression pattern, the subpattern (\w+?) is designed to match multiple words within a sentence. However, the value of the object represents only the last match that (\w+?) captures, whereas the property returns a that represents all captured text. As the output shows, the for the second capturing group contains four objects. The last of these corresponds to the object. code reference: System.Text.RegularExpressions.Group.Class#1 Represents the results from a single capturing group. Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.Text.RegularExpressions.CaptureCollection To be added: an object of type 'CaptureCollection' If a quantifier is not applied to a capturing group, the collection returned by the property contains a single object that provides information about the same substring as the object. This is illustrated in the following example. It defines a regular expression, \b(\w+)\b, that extracts a single word from a sentence. The object captures the word "This", and the single object in the contains information about the same capture. code reference: System.Text.RegularExpressions.Group.Captures#1 The real utility of the property occurs when a quantifier is applied to a capturing group so that the group captures multiple substrings in a single regular expression. In this case, the object contains information about the last captured substring, whereas the property contains information about all the substrings captured by the group. In the following example, the regular expression \b(\w+\s*)+\. matches an entire sentence that ends in a period. The group (\w+\s*)+ captures the individual words in the collection. Because the collection contains information only about the last captured substring, it captures the last word in the sentence, "sentence". However, each word captured by the group is available from the collection returned by the property. code reference: System.Text.RegularExpressions.Group.Captures#2 Gets a collection of all the captures matched by the capturing group, in innermost-leftmost-first order (or innermost-rightmost-first order if the regular expression is modified with the option). The collection may have zero or more items. Property 1.0.5000.0 2.0.0.0 4.0.0.0 System.Boolean To be added: an object of type 'bool' The Success property is true if at least one substring was captured by this group. It is equivalent to the Boolean expression (Group.Captures.Count > 0). Gets a value indicating whether the match is successful. Method 1.0.5000.0 2.0.0.0 4.0.0.0 System.MonoTODO("not thread-safe") System.Text.RegularExpressions.Group To be added Returns a Group object equivalent to the one supplied that is safe to share between multiple threads. A regular expression Group object. The input object.