Maruthi Krishna has Published 870 Articles

Character class p{javaUpperCase} Java regex.

Maruthi Krishna

Maruthi Krishna

Updated on 10-Jan-2020 10:05:40

689 Views

This character class \p{javaUpperCase} matches upper case letters. This class matches the characters which returns true when passed as a parameter to the isUpperCase() method of the java.lang.Character class.Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexExample {    public static void main(String args[]) {       ... Read More

Character class p{javaLowerCase} Java regex.

Maruthi Krishna

Maruthi Krishna

Updated on 10-Jan-2020 09:59:42

531 Views

This character class \p{javaLowerCase} matches lower case letters. This class matches the characters which returns true when passed as a parameter to the isLowerCase() method of the java.lang.Character class.Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexExample {    public static void main(String args[]) {       ... Read More

Posix character classes p{Space} Java regex.

Maruthi Krishna

Maruthi Krishna

Updated on 09-Jan-2020 10:43:03

503 Views

This class matches white space characters. i.e. \t, , \x, 0B, \f, \r.Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class SpaceCharacters {    public static void main(String args[]) {       //Reading String from user       System.out.println("Enter a string");       Scanner sc = ... Read More

Posix character classes p{XDigit} Java regex.

Maruthi Krishna

Maruthi Krishna

Updated on 09-Jan-2020 10:38:16

394 Views

This class matches hexa-decimal characters i.e. [0-9a-fA-F].Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class SpaceCharacters {    public static void main(String args[]) {       //Reading String from user       System.out.println("Enter a string");       Scanner sc = new Scanner(System.in);       String ... Read More

Posix character classes p{Print} Java regex

Maruthi Krishna

Maruthi Krishna

Updated on 09-Jan-2020 10:22:45

1K+ Views

This class matches all the printable characters.Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class PrintableCharacters {    public static void main(String args[]) {       //Reading String from user       System.out.println("Enter a string");       Scanner sc = new Scanner(System.in);       String ... Read More

Posix character classes p{Graph} Java regex

Maruthi Krishna

Maruthi Krishna

Updated on 09-Jan-2020 10:12:14

578 Views

This class matches all visible characters i.e. alphabets, digits, punctuation marks.Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class VisiblieCharacters {    public static void main(String args[]) {       //Reading String from user       System.out.println("Enter a string");       Scanner sc = new Scanner(System.in); ... Read More

Posix character classes p{Punct} Java regex

Maruthi Krishna

Maruthi Krishna

Updated on 09-Jan-2020 09:59:48

3K+ Views

This class matches punctuation marks. i.e.!"#$%&'()*+, -./:;?@[\]^_`{|}~Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class AlphanumericExample {    public static void main(String args[]) {       //Reading String from user       System.out.println("Enter a string");       Scanner sc = new Scanner(System.in);       String ... Read More

Posix character classes p{Alpha} Java regex

Maruthi Krishna

Maruthi Krishna

Updated on 09-Jan-2020 09:45:18

722 Views

This class matches alphabetic characters both upper case and smaller case.Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Example {    public static void main( String args[] ) {       //Regular expression to match lower case letters       String regex = "^\p{Alpha}+$";     ... Read More

Posix character classes p{Upper} Java regex

Maruthi Krishna

Maruthi Krishna

Updated on 21-Nov-2019 08:16:31

266 Views

This class matches the upper case alphabetic characters.Example 1import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Posix_LowerExample {    public static void main( String args[] ) {       //Regular expression to match upper case letters       String regex = "^\p{Upper}+$";       //Getting the input ... Read More

How match a string irrespective of case using Java regex.

Maruthi Krishna

Maruthi Krishna

Updated on 21-Nov-2019 08:06:13

239 Views

The compile method of the patter class accepts two parameters −A string value representing the regular expression.An integer value a field of the Pattern class.This CASE_INSENSITIVE field of the Pattern class matches characters irrespective of case. Therefore, if you pass as flag value to the compile() method along with your ... Read More

Advertisements