Regular Expressions
The concept of regular expressions is illustrated by comparing some concepts that are already familiar to most readers.
The content of this article is all Microsoft company documentation
Thank you for this, like those who have worked for it.
You may not be familiar with this term unless you have used a regular expression before. However, there is no doubt that you have used some regular expression concepts that do not involve scripting.
For example, are you likely to use? and * wildcard characters to find the files on your hard disk. Wildcard characters match a single character in the file name, while the * wildcard matches 0 or more characters. Like data? DAT mode will look for the following files:
Data1.dat
Data2.dat
Datax.dat
DataN.dat
Use the * character instead? The character expands the number of files found. Data*.dat matches all of the following files:
Data.dat
Data1.dat
Data2.dat
Data12.dat
Datax.da
DataXYZ.dat
Although this search method is useful, it is still limited. and * wildcard capabilities introduce concepts that regular expressions rely on, but regular expressions are more powerful and more flexible.
use of regular expressions
Illustrates how regular expressions extend general search conditions through an instance.
A typical search and replace operation requires that you provide exact text that matches the expected search results. While this technique may suffice for performing simple search and replace tasks on static text, it lacks flexibility, and it can be difficult, if not impossible, to search for dynamic text in this way.
By using regular expressions, you can:
Tests the pattern within the string.
For example, you can test the input string to see if phone number mode or credit card number mode appears within the string. This is called data validation.
Replaces text.
You can use regular expressions to identify specific text in a document, to completely delete the text, or to replace it with other text.
Extracts a substring from a string based on pattern matching.
You can find specific text within a document or in an input field.
For example, you might want to search the entire Web site, remove obsolete materials, and replace some HTML formatting tags. In this case, you can use a regular expression to determine whether the material or the HTML formatting tag appears in each file. This procedure shrinks the list of affected files to those that contain materials that need to be deleted or changed. You can then use regular expressions to delete obsolete materials. Finally, you can use regular expressions to search for and replace tags.
Regular expressions are also useful in languages such as JScript or C, and the string-handling power of these languages is not yet known.
Current 1/4 page
1234 Next read the full text