Simply Regex Extensions

Simply Regex is the simple builder API for building complex Regex. Extension libraries are the libraries which adds definitions of specific type of regex. Extensions make simply regex powerful as those definitions of different regex can simplify many challenging regex building in simple ways.

Simply Regex Datatype

Simply regex datatype is an extension library to simply regex which provides easy & simple ways to create regex for different datatypes like numbers or dates.

Number datatype

Creating regex for specific range of numbers is not easy using regex because regex is based on characters & we are expecting it to match as numbers. Building regex for specific number range from scratch is very time complex & can turn out to be buggy i.e. it might match number outside of range or might miss number within range etc.

With Simply Regex Datatype library, all you have to do is provide range of numbers & rest is taken care by library.


This will build complex regex – ipRegex = ([0-9]|[1-9][0-9]|[1-1][0-9][0-9]|[2-2][0-4][0-9]|[2-2][5-5][0-5]|)\Q.\E([0-9]|[1-9][0-9]|[1-1][0-9][0-9]|[2-2][0-4][0-9]|[2-2][5-5][0-5]|)\Q.\E([0-9]|[1-9][0-9]|[1-1][0-9][0-9]|[2-2][0-4][0-9]|[2-2][5-5][0-5]|)\Q.\E([0-9]|[1-9][0-9]|[1-1][0-9][0-9]|[2-2][0-4][0-9]|[2-2][5-5][0-5]|)

Input: testString = “” Output: isMatch = true

Input: testString = “” Output: isMatch = false

Date datatype

Date is a datatype which can have many different formats in different use cases. This makes it challenging to have regex to exactly match the expected format. In java world formatting is handled using SimpleDateFormat which offers very wide variety of formats using specific Date and Time Patterns.

Simply regex datatype extension library provides easy way to build regex using same formats which are supported by SimpleDateFormat.


This will build complex regex – regex = ((0{0,1}[1-9]|[1-1][0-2]|))\Q/\E((0{0,1}[1-9]|[1-2][0-9]|[3-3][0-1]|))\Q/\E([\d]{4})

Leave a Reply

Your email address will not be published. Required fields are marked *