What is the purpose of the Pattern.compile() method in Java regex?

Last Updated :
Discuss
Comments

What is the purpose of the Pattern.compile() method in Java regex?

It matches a string with the provided pattern

It creates a new Matcher object from a regular expression pattern

It converts a regular expression into a human-readable format

It compiles a string into a regular expression pattern object

Share your thoughts in the comments