Regular Expression
Re-pattern function:
The function (re-pattern) accepts a string parameter and returns a regular expression style (java. util. regex. Pattern class instance ). This style can be used for regular expression matching.
You can also use a macro to directly input a regular expression in text format: Use the # symbol before the string. The expression is the same as that generated using the re-pattern function. For example, the following representation is the same as that in the previous example:
Re-matcher function:
The re-matcher function accepts two parameters: a regular expression style and a string. Returns a stateful "matcher" object, which is provided to other regular functions rather than directly providing styles. Matchers is an instance of the java. util. regex. Matcher. Class.
The def function is used to define variables, which will be described later.
Ii. Use a regular expression:
Re-find function:
Re-find accepts a style with a string or a matcher. After each call, the next matching result in matcher is returned.
Re-matches function:
Re-matches accepts two parameters: a regular expression style and a string. Returns any string that matches the regular expression style. If no match exists, returns nil. For example, the following code:
Re-seq function:
Re-seq accepts a style and a string. It returns a lazy sequence (lazy sequence) that uses matcher (this sequence is in a continuous style matching string)
Re-groups function:
Accept a matcher and return the set of discovery and matching from proximity. If no nested set exists, a fully matched string is returned. If a nested set exists, the vector set is returned. The first element is completely matched (non-nested)