- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Maruthi Krishna has Published 951 Articles
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
460 Views
The subexpression/metacharacter “\E” ends the quoting begun with \Q. i.e. you can escape metacharacters in the regular expressions by placing them in between \Q and \E. For example, the expression [aeiou] matches the strings with vowel letters in it.Example Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class SampleProgram { ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
88 Views
The PatternSyntaxException class represents an unchecked exception thrown in case of a syntax error in regex string. This class contains three main methods namely −getDescription() − Returns the description of the error.getIndex() − Returns the error index.getPattern() − Returns the regular expression pattern with error.getMessage() − Returns the complete message congaing ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
2K+ Views
You can form matched groups in the regular expression by separating the expressions with parenthesis. In following regular expression the first group matches digits and the second group matches the English alphabet −(\d)([A-Za-z])In short, it matches the part in the input string where a digit followed by an alphabet.Since the ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
7K+ Views
Following regular expression matches a string that contains at least one alphanumeric characters −"^.*[a-zA-Z0-9]+.*$";Where, ^.* Matches the string starting with zero or more (any) characters.[a-zA-Z0-9]+ Matches at least one alpha-numeric character..*$ Matches the string ending with zero or more (ant) characters.Example 1 Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
4K+ Views
The "|" meta character: The meta character "|" in Java regular expressions allows you to match more than one regular expressions for example if you need to match a particular input text with more than one expression you need to separate them using it as:exp1|exp2|exp3Example Live Demoimport java.util.Scanner; import java.util.regex.Matcher; import ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
43 Views
The java.util.regex.MatcheResult interface provides methods to retrieve the results of a match.You can get an object of this interface using the toMatchResult() method of the Matcher class. This method returns a MatchResult object which represents the match state of the current matcher.The end(int group) method of this interface accepts an integer ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
60 Views
The java.util.regex.MatcheResult interface provides methods to retrieve the results of a match.You can get an object of this interface using the toMatchResult() method of the Matcher class. This method returns a MatchResult object which represents the match state of the current matcher.The start() method of this interface returns the beginning index ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
300 Views
This character class \p{javaMirrored} matches upper case letters. This class matches the characters which returns true when passed as a parameter to the isMirrored() 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
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
323 Views
This character class \p{javaWhitespace} matches spaces. This class matches the characters which returns true when passed as a parameter to the isWhitespace() 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[]) { //Reading String ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
513 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