Split a string by regular expression
This is an example of how to split a String using regular expression. Splitting a String with a regular expression implies that you should: Compile a given String regular expression to a Pattern, using...
View ArticleGet all digits from a string
With this example we are going to demonstrate how to get all digits from a String, using a regular expression. In short, to get all digits from a String you should: Use a given String with letters and...
View ArticleFind occurances of a letter in a string
In this example we shall show you how to find occurances of a specific letter in a String. To find occurances of a letter in a String one should perform the following steps: Compile a given String...
View ArticleSimple positive Lookbehind
This is an example of a simple positive look behind. Positive look behind methods assert the existence of a pattern to the left of the position of a String. You can form positive look behinds by...
View ArticleStrip extra spaces in a string
With this example we are going to demonstrate how to strip extra spaces in a String. In short, to strip extra spaces in a String you should: Use a given String with spaces between words. Use...
View ArticleMatcher.appendReplacement example – Part 2
In this example we shall show you how to use Matcher.appendReplacement(StringBuffer sb, String replacement) API method to append to a StringBuffer the result of a Matcher. To use a StringBuffer to...
View ArticleDetermine if a string matches a pattern exactly
This is an example of how to determine if a String matches to a Pattern exactly. Using a Matcher to check if a String matches to a specified Pattern implies that you should: Compile a given String...
View ArticleFind duplication in strings example
With this example we are going to demonstrate how to find duplication in Strings. In order to check if there are duplications in a String we have created a Matcher against a specified Pattern and used...
View ArticleSimple validation example
In this example we shall show you how to make a simple validation of a String, using a Matcher against a specified Pattern. To make a simple String validation one should perform the following steps:...
View ArticleSpring Expression Language Example
The Spring Expression Language (SpEL for short) is a powerful expression language that supports querying and manipulating an object graph at runtime. SpEL expressions can be used with XML or annotation...
View Articlejava.util.regex.PatternSyntaxException Example
In this example we will discuss about java.util.regex.PatternSyntaxException. This exception is thrown when a regex (a regular exception) pattern is not correct, i.e. has syntax errors. The...
View ArticleGroovy Regex Example
In this example I will show you how to use regular expressions in Groovy. 1. Groovy and Regular Expressions Groovy is one of the most commonly used JVM languages and regular expressions (or simply...
View ArticleGroovy Regex Example
1. Introduction Regular Expression is a character sequence defines search pattern especially for pattern matching with strings. You may see Regular Expression as Regex or Regexp in software world. In...
View ArticleJava 9 Regular Expressions Example
1. Introduction In this example we will explore the java.util.regex package and the abstractions contained within it that facilitate the usage of regular expressions in Java 9. Even though the common...
View ArticleMongoDB Regular Expressions Example
Hello readers, a regular expression or regex is a sequence of characters that explains a specific search pattern. In this tutorial, we will learn how to use the regular expressions in the Mongo...
View ArticleObtain Regex Pattern Matches Indexes
In the realm of Java programming, working with strings and patterns is indispensable for numerous applications. Regular expressions, often referred to as regex, offer a potent tool for both pattern...
View ArticleConvert Unicode Encoding String to Letters
Dealing with strings encoded in Unicode is a common task in Java programming, especially in multilingual applications where text comes in various scripts and languages. Java provides mechanisms to...
View Article