A regular expression (Regular Expression) is a text pattern that includes normal characters (for example, letters between an and z) and special characters (called metacharacters).
Regular expressions use a single string to describe and match a series of strings that match a syntactic rule.
Regular expression is tedious, but it is powerful, and the application after learning will not only improve your efficiency, but also give you an absolute sense of achievement. As long as you read this tutorial carefully and make some reference when applying it, it is not a problem to master regular expressions.
Many programming languages support string manipulation using regular expressions.
现在开始学习正则表达式! The following example finds a number from the string str: Extract the contents of the numeric portion from the string str (match once): The text of the following tag is the obtained matching expression: 14.1.1. Example ¶
14.1.2. Example ¶
varstr="abc123def";varpatt1= /[0-9]+/;document.write(str.match(patt1));
123
14.1.3. Testing tool ¶