|
@@ -39,25 +39,25 @@ public class HamletParser {
|
39
|
39
|
}
|
40
|
40
|
|
41
|
41
|
public boolean findHoratio() {
|
42
|
|
- Pattern pattern = Pattern.compile(("Horatio"));
|
|
42
|
+ Pattern pattern = Pattern.compile(("[Hh][Oo][Rr][Aa][Tt][Ii][Oo]"));
|
43
|
43
|
Matcher matcher = pattern.matcher(hamletData);
|
44
|
44
|
return matcher.find();
|
45
|
45
|
}
|
46
|
46
|
|
47
|
47
|
public void changeHorationToTariq() {
|
48
|
|
- Pattern pattern = Pattern.compile(("Horatio"));
|
|
48
|
+ Pattern pattern = Pattern.compile(("[Hh][Oo][Rr][Aa][Tt][Ii][Oo]"));
|
49
|
49
|
Matcher matcher = pattern.matcher(hamletData);
|
50
|
50
|
hamletData = matcher.replaceAll("Tariq");
|
51
|
51
|
}
|
52
|
52
|
|
53
|
53
|
public boolean findHamlet() {
|
54
|
|
- Pattern pattern = Pattern.compile(("Hamlet"));
|
|
54
|
+ Pattern pattern = Pattern.compile(("[Hh][Aa][Mm][Ll][Ee][Tt]"));
|
55
|
55
|
Matcher matcher = pattern.matcher(hamletData);
|
56
|
56
|
return matcher.find();
|
57
|
57
|
}
|
58
|
58
|
|
59
|
59
|
public void changeHamlettToLeon() {
|
60
|
|
- Pattern pattern = Pattern.compile("Hamlet");
|
|
60
|
+ Pattern pattern = Pattern.compile("[Hh][Aa][Mm][Ll][Ee][Tt]");
|
61
|
61
|
Matcher matcher = pattern.matcher(hamletData);
|
62
|
62
|
hamletData = matcher.replaceAll("Leon");
|
63
|
63
|
}
|