JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
Author: LukArToDo
Created: 22.01.2018
Description: Examples of using regex expressions
*/
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static java.lang.System.out;
public class RegexExample {
public static void main(String...ar){
out.println("For a better understanding, read the comments carefully :)");
testingExamples();
lookBehindAhead();
substitutionsGroupingAndBackreference();
manipulateStringWithRegex(); //matches, replace, split...
}
static void testingExamples() {
out.println("\ntestIsTrue()\n"+
isTrue("true") +" 'true'\n"+
isTrue("true2")+" 'true2'\n"+
isTrue("True")+" 'True");
out.println("\ntestIsTrueVersion2()\n"+
isTrueVersion2("true")+" 'true'\n"+
isTrueVersion2("true2")+" 'true2'\n"+
isTrueVersion2("True")+" 'True'");
out.println("\ntestIsTrueOrYes()\n"+
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run