Java regular expressions

xiaoxiao2021-03-06  61

Regular expression definition: It is a model or template for matching strings.

Syntax: The simplest form is to find one or a paragraph. It uses some special characters, such as [*], represents any form of string. [

] Indicates any single string.

Correlated packages and classes of regular expressions in JDK:

Java.util.Regex.pattern: Build a matching model

Java.util.Regex.matcher: Matcher

Steps to use these two classes:

1. Compile your regular expression into the instance of Pattern.

2. Create a Matcher object using the Pattern object.

3. Use the Matcher object to control or manipulate this character sequence.

转载请注明原文地址:https://www.9cbs.com/read-84427.html

New Post(0)