Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
HowToDoInJava
  • Java
  • Spring AI
  • Spring Boot
  • Hibernate
  • JUnit 5
  • Interview

Java Regex – Regular Expression Tutorials

Java Regex or regular expressions can add, remove, isolate, and generally fold, spindle, and mutilate all kinds of text and data.

Lokesh Gupta

August 15, 2024

Java Regular Expressions, Series
Series
Java regex

Regular expressions are the key to powerful, flexible, and efficient text processing. It allows us to describe and parse text. Regular expressions can add, remove, isolate, and generally fold, spindle, and mutilate all kinds of text and data.

1. Getting Started

  • Intro to Java Regex
  • Java Regex Meta-characters
  • Java Regex Pattern Matching Symbols

2. Working with Regex

  • Match Any Character(s)
  • Match Start or End of String (Line Anchors)
  • Remove non-printable non-ASCII characters
  • Match Word with All Misspellings
  • Limit the number of lines in the text
  • Limit the number of words in the input
  • Check Min/Max Length of Input Text
  • Allow only alphanumeric characters
  • Date validation using RegEx
  • Java regex word boundary – match a specific word or contain words
  • Java regex word boundary – match the lines that starts with and ends with pattern

3. Commonly Used Patterns

  • Credit Card Number Validation
  • UK Postal Code Validation
  • Canada Postal Code Validation
  • US Zip Code Validation
  • Trademark Symbol Validation
  • Email Validation
  • Password Validation
  • Validate ISBN (International Standard Book Number)
  • Validate SSN (Social Security Numbers)
  • Validate International Phone Numbers
  • Validate North American Phone Numbers
  • Validate Greek Extended or Greek Script
  • Validate Currency Symbols

Happy Learning !!

Java Regex Tutorial

  • Regex Introduction
  • Alphanumeric
  • Credit Card Numbers
  • Canadian Postcodes
  • Currency Symbol
  • Date Format
  • Email Address
  • Password
  • Greek Characters
  • ISBNs
  • Min/Max Length
  • No. of Lines
  • No. of Words
  • SSN
  • UK Postal Codes
  • US Postal Codes
  • Trademark Symbol
  • Intl Phone Numbers
  • North American Phone Numbers
Photo of author

Lokesh Gupta

A fun-loving family man, passionate about computers and problem-solving, with over 15 years of experience in Java and related technologies. An avid Sci-Fi movie enthusiast and a fan of Christopher Nolan and Quentin Tarantino.
Follow on Twitter Portfolio

Previous

Java Logging

Next

Password Encoders in Spring Security

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.

Tutorial Series

OOP

Regex

Maven

Logging

TypeScript

Python

Meta Links

About Us

Advertise

Contact Us

Privacy Policy

Our Blogs

REST API Tutorial

Follow On:

  • Github
  • LinkedIn
  • Twitter
  • Facebook
Copyright © 2026 | Sitemap