Java-Regular Expressions with String Class

Regular Expressions with String Class If all you want to do with a regular expression is check to see whether a string matches a pattern, you can use the matches( ) method of the String class. This method accepts a regular expression as a parameter and returns a boolean that indicates whether or not the … Read more…

Java-Negative Lookbehind

Negative Lookbehind Negative lookbehind is usually useful if we want to match something not proceeded by something else. We can make our own negative lookbehinds with the lookbehind operator (?<!). For example, to match two characters not proceeded by four digit, we could use :   More Examples   Negative lookbehind After the Match Examples   Program Program Source import … Read more…

Java-Lookbehind

Lookbehind Lookbehind is just like Lookahead. They only assert whether immediate portion behind a given input string’s current portion is suitable for a match or not. We can make our own lookbehinds with the lookbehind operator (?<=). Lookbehind Before the Match Examples   Lookbehind with Lookahead   Lookbehind After the Match Examples   Program Program Source … Read more…

Java-Negative Lookahead

Negative Lookahead Negative lookahead is usually useful if we want to match something not followed by something else. We can make our own negative lookaheads with the lookahead operator (?!). For example, to match all characters not followed by a digit, we could use :   More Examples   Negative Lookahead Before the Match Examples … Read more…

Java-QuoteReplacement

QuoteReplacement The replacement string can contain references to the groups in the pattern: $n is replaced with the nth group, and ${name} is replaced with the group that has the given name. Use \\$ to include a $ character in the replacement text. If you have a string that may contain $ and \, and … Read more…