Question: string reg = ([A-z][a-z],s+([A-z][a-z]+); using pattern pattern = pattern.compile(reg); add the regular expression to the working javafx code & show output. (could you use ?

string reg = "([A-z][a-z],\s+([A-z][a-z]+)";
using pattern pattern = pattern.compile(reg);
add the regular expression to the working javafx code & show output. (could you use ? if so pls)
import java.util.regex.*;
import java.util.*;
import java.io.*;
public class JavaRegex {
public static void main(String args[]){
/*
//Search words in text.
String text = "ThJAVAis is a jaVARegular javaExpressiJaVAon";
String word = "JAVA";
System.out.println(text);
Pattern pattern = Pattern.compile(word,Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(text);
while (matcher.find()){
System.out.printf("word= %s start at %d , end at %d ",matcher.group(),matcher.start(),matcher.end());
}
*/
/*
//Delimiter
String text = "Java:is;a program;test.regular,expression";
String delimiter="[,;.:]";
Pattern pattern = Pattern.compile(delimiter,Pattern.CASE_INSENSITIVE);
String[] mystr=pattern.split(text);
for(String s:mystr)
System.out.println(s);
*/
//More about search words in text
//Example: First name and Last name
/*
String text = "Tim Martin, James Madison , John Brown , Kim Smith Khomsun Sing";
String reg = "[A-z][a-z]+\s+[A-z][a-z]+";
System.out.println(text);
Pattern pattern = Pattern.compile(reg,Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(text);
while (matcher.find()){
System.out.printf("word= %s start at %d , end at %d ",matcher.group(),matcher.start(),matcher.end());
}
*/
//Open file and extract more words
//String reg = "([A-z][a-z]+),\s+([A-z][a-z]+)";
/*
Pattern pattern = Pattern.compile(reg);
File file = new File("studentlist.csv");
try(Scanner input = new Scanner(file)){
while(input.hasNext()) { //read one line
String text = input.nextLine();
//System.out.println("t"+text);
Matcher matcher = pattern.matcher(text);
while (matcher.find()){
System.out.print(matcher.group(1));
System.out.print(matcher.group(2));
System.out.println(matcher.group(3));
}
}
}
catch(FileNotFoundException e) {
}
*/
}
}
i just want you to explain the program and add the regular expression with warning & pattern!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!