java regular expression-no loss to know-

In java, arrays and characters are sometimes decomposed and stored in arrays.

At that time, split is performed using the split method, but it is processed like this. (Variable name is appropriate)

private static final String SEPARATOR = "(\\s+?|\\.|,|;)";

String[] words = line.split(SEPARATOR);

"(\s+?|\.|,|;)";What is

These are regular expressions.

Specifically, it means "one or more spaces, periods, commas, or semicolons."

| Means one of the delimiters, and \. Is just a period (two backslashes are required for string notation).

Depending on the OS, \ becomes , or even though you type \ twice, only one is displayed on this screen.

It was learning (= ゜ ω ゜) no

Recommended Posts

java regular expression-no loss to know-
Easy to trip with Java regular expressions
Introduction to java
Changes from Java 8 to Java 11
Sum from Java_1 to 100
[Java] Connect to MySQL
Kotlin's improvements to Java
[Java] How to execute tasks on a regular basis
From Java to Ruby !!
java regular expression summary
Notes on how to use regular expressions in Java
11 items I don't know if it's good to know about JAVA
[Java] How to use Map
How to lower java version
Migration from Cobol to JAVA
[Java] How to use Map
Convert Java Powerpoint to XPS
Java adds table to PDF
How to uninstall Java 8 (Mac)
Java to play with Function
Java --How to make JTable
How to use java Optional
How to minimize Java images
How to use java class
[Java] How to use Optional ②
[Java] How to use removeAll ()
[Java] How to display Wingdings
[Java] Introduction to lambda expressions
[Java] How to use string.format
Shell to kill Java process
How to set Java constants
Connect to DB with Java
Connect to MySQL 8 with Java
[java] Reasons to use static
How to use Java variables
[Java] Introduction to Stream API
How to convert Java radix
[Java] Convert ArrayList to array
Java thread to understand loosely
[Java] How to implement multithreading
[Java] How to use Optional ①
From Ineffective Java to Effective Java
How to initialize Java array
[Introduction to rock-paper-scissors games] Java
Input to the Java console
Replace with a value according to the match with a Java regular expression