Maruthi Krishna has Published 870 Articles

Regular Expression re+ Metacharacter in Java

Maruthi Krishna

Maruthi Krishna

Updated on 19-Nov-2019 06:29:49

162 Views

The subexpression/metacharacter “re+” matches one or more occurrences of the preceding expression.Example 1import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexExample {    public static void main( String args[] ) {       String regex = "aabc+";       String input = "aabcabcaabcabbcaabcbcaabc";       Pattern p = Pattern.compile(regex); ... Read More

Regular Expression "z" construct in Java

Maruthi Krishna

Maruthi Krishna

Updated on 19-Nov-2019 06:23:55

157 Views

The subexpression/metacharacter “\z” matches the end of a string.Example1import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexExample {    public static void main( String args[] ) {       String regex = "Tutorialspoint\z";       String input = "Hi how are you welcome to Tutorialspoint";       Pattern p ... Read More

Regular Expression "\Z" Metacharacter in Java

Maruthi Krishna

Maruthi Krishna

Updated on 19-Nov-2019 06:21:36

497 Views

The subexpression/metacharacter “\Z” matches the end of the entire string except allowable final line terminator.Example 1import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexExample {    public static void main( String args[] ) {       String regex = "Tutorialspoint\z";       String input = "Hi how are you welcome ... Read More

Regular Expression "A" construct in Java

Maruthi Krishna

Maruthi Krishna

Updated on 19-Nov-2019 06:18:18

232 Views

The subexpression/metacharacter “\A” matches the beginning of the entire string.Example 1import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexExample {    public static void main( String args[] ) {       String regex = "\AHi";       String input = "Hi how are you welcome to Tutorialspoint";       ... Read More

Regular Expression "[^...]" construct in Java

Maruthi Krishna

Maruthi Krishna

Updated on 19-Nov-2019 06:17:16

210 Views

The subexpression/metacharacter “[^...]” matches any single character, not in brackets.Example 1import java.util.regex.Matcher; import java.util.regex.Pattern; public class SpecifiedCharacters {    public static void main( String args[] ) {       String regex = "[^hwtyoupi]";       String input = "Hi how are you welcome to Tutorialspoint";       ... Read More

Explain the sub-expression "[...]" in Java Regular expressions

Maruthi Krishna

Maruthi Krishna

Updated on 19-Nov-2019 06:04:54

335 Views

The subexpression “[...]” matches any single character specified in the brackets.Example 1import java.util.regex.Matcher; import java.util.regex.Pattern; public class SpecifiedCharacters {    public static void main( String args[] ) {       String regex = "[hwt]";       String input = "Hi how are you welcome to Tutorialspoint";     ... Read More

Regular Expression "re*" Metacharacter in Java

Maruthi Krishna

Maruthi Krishna

Updated on 18-Nov-2019 11:59:46

160 Views

The subexpression/metacharacter “re*” matches 0 or more occurrences of the preceding expression.Example 1import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexExample {    public static void main( String args[] ) {       String regex = "aabc*";       String input = "aabcabcaabcabbcaabcbcaabc";       Pattern p = Pattern.compile(regex); ... Read More

Explain Regular Expression "A" Metacharacter in Java

Maruthi Krishna

Maruthi Krishna

Updated on 18-Nov-2019 11:57:12

269 Views

The subexpression/metacharacter “\A” matches the beginning of the entire string.Example 1import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexExample {    public static void main( String args[] ) {       String regex = "\AHi";       String input = "Hi how are you welcome to Tutorialspoint";       ... Read More

Regular Expression "." (dot) Metacharacter in Java

Maruthi Krishna

Maruthi Krishna

Updated on 18-Nov-2019 10:29:25

1K+ Views

The subexpression/metacharacter “.” matches any single character except a newline.Example1import java.util.regex.Matcher; import java.util.regex.Pattern; public class MatchesAll {    public static void main( String args[] ) {       String regex = ".";       String input = "Hi how are you welcome to Tutorialspoint";       Pattern ... Read More

Regular Expression "$" (dollar) Metacharacter in Java

Maruthi Krishna

Maruthi Krishna

Updated on 18-Nov-2019 10:17:40

1K+ Views

The subexpression/metacharacter “$” matches the end of a line.Example 1import java.util.regex.Matcher; import java.util.regex.Pattern; public class EndWith {    public static void main( String args[] ) {       String regex = "Tutorialspoint$";       String input = "Hi how are you welcome to Tutorialspoint";       Pattern ... Read More

Advertisements