| **Navigation:**  »No topics above this level«====== Regular Expressions Toolkit ====== | {{btn_prev_d.gif}}[[coming future.htm|{{btn_home_n.gif|Return to chapter overview}}]]{{btn_next_d.gif}} | | || Regular Expressions are a powerful pattern matching language that is part of many modern programming languages. It is a //special text string// for describing a search pattern. Regular Expressions allow you to apply a **pattern** to an input string and return a list of the matches within the target text. Regular expressions also allow text to be replaced using replacement patterns. It is a very powerful version of search and replace. This window allows you to test a regular expression, and then to compile it to a .NET assembly. It is an excellent tool for you to experiment and learn regular expression before applying them to your real applications. The following prompts are supported in the toolkit: **Regular Expression** Enter a valid Regular Expression to test. The button to the right has a context list of special characters shown here: {{blk2blue.jpg|blk2blue.jpg}} **Ungreedy star** The question mark tells the engine to attempt match the preceding token zero times or once, in effect making it optional. In the first step it still will match all that is possible but then it will do some "back stepping" to give back one character at a time until the minimum characters that constitute a successful match are reached. **Word Character Value** "\w" stands for any letter or the underscore character. This group is called an alphanumeric character. **Non-Word** **Character Value** \W is stands for any non-alphanumeric character. **Whitespace Character** "\s" represents so-called whitespace characters, that is any character which produces white space on the screen: space, tabs, newline, carriage return, line feed. It's ok if you just remember that any void space in a string will be matched. And, of course, you may negate this pattern: **Non-whitespace Character** "\S" matches any character that does not appear as white space in the string. **Digit Character** "\d" symbolizes a digit. "\d\d" searches for any sequence of two digits. **Non-digit Character** "\D" means any character that is not a digit **Word border** \b" makes the regular expression search for the pattern at word boundaries. {{blk2blue.jpg|blk2blue.jpg}} **Input** Enter a test string that you will use to test the regular expression. **Replace** If you would like to replace the test Input string when a valid expression match is encountered. Check this box. **Replacement string** Enter the string value that you would like to you to replace the matches found in the Regular Expression **Replace result** The Replace result is the Input text string you entered AFTER it has been replaced by the replacement string.Katatonia **Multiline** Check this box if the Input string to be searched spans multiple lines. **Ignore case** Check this box to make your test RegEx search case insensitive. {{gold.jpg|gold.jpg}} In the **Compile** tab: Use the Regular Expression Toolkit to build a .NET assembly. You can embed the Regular Expression and pass it a valid text string to search into. **Assembly** Enter a valid Assembly name **Namespace** Enter a valid Namespace **Class name** Enter a valid Class name.