Programming Tutorial On The Way

free online programming resource on dotnet, csharp, web related topics

Using the Replace instance method on the Regex class allows for easy replacement of text within a string. The following overloaded Replace methods accept a source string that contains characters or words to be replaced, a matchPattern to match the replaceable text in the source parameter, and a replaceStr string to replace the text matched [...]

Popularity: 3% [?]

You need to find the last pattern match in a string, but you do not want the overhead of finding all matches in a string and having to move to the last match in the collection of matches. Using the RegexOptions.RightToLeft option, the match starts at the end of the string and proceeds toward [...]

Popularity: 2% [?]

\\\\(?<TheServer>\w*)\\(?<TheService>\w*)\
where the named group TheServer will match any server name within a UNC string, and TheService will match any service name within a UNC string. You need to store the groups that are returned by this regular expression in a keyed collection (such as a Hashtable) in which the key is the group name.
Popularity: [...]

Popularity: 1% [?]

Enumerating Matches

In this article, we will talk about finding one or more substrings corresponding to a particular pattern within a string using Regular Expression. You need to be able to inform the searching code to return either all matching substrings or only the matching substrings that are unique within the set of all matched strings.
Popularity: 1% [...]

Popularity: 1% [?]

There are many mechanisms for recording state information about applications, other than creating a file full of the information. One example of this type of mechanism is the Windows Event Log, where informational, security, and error states can be logged during an application’s progress. One of the primary reasons for creating a log file is [...]

Popularity: 2% [?]

You need to create a file-possibly for logging information to or storing temporary information-and then write information to it. You also need to be able to read the information that you wrote to this file. To create, write to, and read from a log file, we will use the FileStream and its reader and writer [...]

Popularity: 3% [?]

Counting Lines of Text

Every line ends with a special character. For Windows files, the line terminating characters are a carriage return followed by a linefeed. This sequence of characters is described by the regular expression pattern \r\n. Unix files terminate their lines with just the linefeed character (\n). The regular expression “\n” is the lowest common denominator for [...]

Popularity: 1% [?]

Compiling Regular Expressions

Compiling regular expressions allows the expression to run faster. To understand how, we need to examine the process that an expression goes through as it is run against a string. If an expression is not compiled, the regular expression engine converts the expression to a series of internal codes that are recognized by the regular [...]

Popularity: 2% [?]

« Previous Entries  Next Entries »