Hi, how to break the text below based on the template
Sample text:
Overview This is my sample program Written in java
Required conclusion
I tried the following regex but didn't work
"\\s{2,}\\[Az]"
Please suggest me a regex to separate text
Use a positive forward forecast ( (?=[AZ]) ) to match the uppercase alphabet without using:
(?=[AZ])
String text = "Overview This is my sample program Written in java"; String[] words = text.split("\\s{2,}(?=[AZ])"); for (String word : words) System.out.println(word);
String text = "Overview This is my sample program Written in java"; String[] words = text.split("\\s{2,}"); for (String word : words) { System.out.println(word); }
You do not need to use a positive look ahead.
Source: https://habr.com/ru/post/1498902/More articles:Can C ++ 11 compilers introduce extra loads of atomic variables? - multithreadingcould not find the class referenced by the android method java.lang.NoClassDefFoundError - javaWhere to start serious parallel (multithreaded, parallel?) Programming - multithreadingCorrect way to define Gradle plugin property extension using Java? - javaThe database is not displayed in the DDMS folder when the real device is used instead of the emulator - androidDropdownlist using summarization data in mvc4 using C # - c #An unresolved external symbolic error that occurs only in 64-bit mode and not in a 32-bit assembly - c ++How to get the header file WTTLog.lib and wttlogger.h for the 64-bit version of WTTLog.DLL - c ++synchronizedList access by multiple threads - javafile not recognized: file format not recognized - cAll Articles