Home » Tag Archives: Regular Expressions

Tag Archives: Regular Expressions

The regex that broke a server

I’ve never thought I would see an unresponsive server due to a bad regex matcher but that’s just happened to one of our services, yielding it it unresponsive. Let’s assume we parse some external dealer car info. We are trying to find all those cars with “no air conditioning” among various available input patterns (but without matching patterns such as ...

Read More »

Using regex to hanging indent a paragraph in Java

This post shows how to hanging indent a long paragraph using regular expression. The method will consider word boundaries, which means it will not break words for the indentation. To illustrate the problem, consider the following example: There has been an increasing effort in recent years to extract relations between entities from natural language text. In this dissertation, I will ...

Read More »

Backreferences in Java Regular Expressions

Backreferences in Java Regular Expressions is another important feature provided by Java. To understand backreferences, we need to understand group first. Group in regular expression means treating multiple characters as a single unit. They are created by placing the characters to be grouped inside a set of parentheses – ”()”. Each set of parentheses corresponds to a group. Backreferences are ...

Read More »

Java Regular Expression Tutorial with Examples


When I started my career in java, regular expressions were a nightmare for me. This tutorial is aimed to help you mastering java regular expression and for me to come back at regular interval to refresh my regular expressions learning. What Are Regular Expressions? A regular expression defines a pattern for a String. Regular Expressions can be used to search, ...

Read More »

Regular Expressions in Java – Soft Introduction

A regular expression is a kind of pattern that can be applied to text (String, in Java). Java provides the java.util.regex package for pattern matching with regular expressions. Java regular expressions are very similar to the Perl programming language and very easy to learn. A regular expression either matches the text ( or a part of it) or it fails ...

Read More »