- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEx20RegExp.java
More file actions
Latest commit
16 lines (15 loc) · 583 Bytes
/
Copy pathEx20RegExp.java
File metadata and controls
16 lines (15 loc) · 583 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
packageJavaEntry;
importjava.util.regex.Matcher;
importjava.util.regex.Pattern;
publicclassEx20RegExp {
publicstaticvoidmain(String[] args){
PatterncustPattern = Pattern.compile("SMU", Pattern.CASE_INSENSITIVE);
MatcherfindWord = custPattern.matcher("My name is Banti Shaw and I am doing MCA from SMU.");
booleancheckText = findWord.find();
if(checkText){
System.out.println("Sentence contain the provided text");
}else {
System.out.println("Provided text not exist in the sentence");
}
}
}