兼有js与java的正则用法(国外英文资料).docVIP

  • 0
  • 0
  • 约1.21万字
  • 约 19页
  • 2017-06-05 发布于河南
  • 举报

兼有js与java的正则用法(国外英文资料).doc

兼有js与java的正则用法(国外英文资料)

兼有js与java的正则用法 The regular expressions in JAVA are introduced One, what is a regular expression A regular expression is a powerful tool that can be used for pattern matching and substitution. We can find regular expressions in almost all UNIX based tools, such as vi editors, Perl or PHP scripting languages, and awk or sed shell programs. In addition, client-side scripting languages such as JavaScript provide support for regular expressions. Regular expressions allow users to use a series of special characters to build a matching pattern for information validation. In addition, it can effectively create, compare, and modify strings, and quickly analyze large amounts of text and data to search, remove, and replace text. Such as: Second, basic knowledge Start and end symbols (they also belong to the locator) Lets start with a simple one. Suppose you want to write a regular expression rules, you will be using ^ and $sign, they are the beginning of a line operator, end-of-line character. For example: / ^ \ d + [0-9]? \ d + $/ 1.2 period symbol Lets say youre playing English scrabble, and you want to find the three letters, and the words must begin with the letter t and end with the n letter. Also, if you have an English dictionary, you can search for it with regular expressions. To construct this regular expression, you can use a wildcard, the period symbol. So, full expression is t.n, it matches the tan, ten, tin and ton, also match t# n, TPN and even t n, there are many other meaningless combination. This is because the period symbol matches all characters, including Spaces, Tab characters, and even line breaks: 1.3 square brackets In order to solve the problem of the syntactic symbol matching range, you can specify a meaningful character in square brackets ( [] ). At this point, only the characters specified in the square brackets match. In other words, the regular expression t [aeio] n matches only tan , Ten, tin and ton. But Toon does not match because within square

文档评论(0)

1亿VIP精品文档

相关文档