Replacing non-ASCII characters using Java Regular Expressions
package com.kushal.utils; /** * ReplaceNonASCIICharacters.java * @author Kushal Paudyal * www.sanjaal.com/java * * This class reads a file with non ASCII Characters in it. * Replaces the non ASCII...
View ArticleHow To Find Wild Cards In A String Using Regular Expressions?
This is how it began – our users started using wild cards (%%) sign in the search query. Since our legacy application had queries with like clause (apparently the original developers thought the end...
View ArticleRegular Expression to validate the US zip codes
Here is a Regular Expression to validate the united states 5 and 9 digit zip codes: ^\d{5}(-\d{4})?$ Basic Validations: • First five letters should be digits. • It can be followed by a dash and...
View ArticleUS 5 and 9 Digits Zip Code Validation In Java Using Regular Expressions
ZIP codes are a system of postal codes used by the United States Postal Service (USPS) since 1963. The term ZIP, an acronym for Zone Improvement Plan, is properly written in capital letters and was...
View ArticleHow to find if a string is contained in another string using regex in Java?
This is a simple utility to find out (through regular expressions) if a string is contained in another string. The string to search may be located anywhere in the text to look into (i.e. it may lie at...
View ArticleProgrammatically Validating US and Canada Phone Numbers Using Regular...
The following java program checks for the validity of US and Canada phone number formats using regular expression. The regular expression used here can handle the following rules: The starting...
View ArticleJava Regular Expressions – Single World Replacement Example /Tutorial
Please refer to my previous article for regular expression theory, classes and syntax. In this post I am posting a code that I wrote which does a single word replacement on a string using Pattern and...
View ArticleDate Format Validation (mmddyy and ddmmyy) in Java Using Regular Expressions
The following java program has the capability of doing the date format validation in software using regular expressions and is able to validate both mmddyy and ddmmyy date formats (of course the date,...
View ArticleMultiple Email Address Validation With Java Regular Expressions (RegEx)
In this example I have demonstrated the use of the regular expressions in Java programming language to do a validation of the email address. The email address might be just one or multiples selected by...
View ArticleHow to validate PO Box Address Variations With Java Regular Expressions?
Address validation in Java could be a little tricky thing if you are unwilling to use Java Regular Expression. This is because of complexity caused by the variations of the components of the address...
View Article