Java 9 Regular Expressions

Solve real world problems using Regex in Java.
Preview in Mapt

Java 9 Regular Expressions

Anubhava Srivastava

Solve real world problems using Regex in Java.
Mapt Subscription
FREE
$29.99/m after trial
eBook
$19.60
RRP $27.99
Save 29%
Print + eBook
$34.99
RRP $34.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$19.60
$34.99
$29.99p/m after trial
RRP $27.99
RRP $34.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Java 9 Regular Expressions Book Cover
Java 9 Regular Expressions
$ 27.99
$ 19.60
JavaScript Regular Expressions Book Cover
JavaScript Regular Expressions
$ 27.99
$ 19.60
Buy 2 for $35.00
Save $20.98
Add to Cart
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 

Book Details

ISBN 139781787288706
Paperback158 pages

Book Description

Regular expressions are a powerful tool in the programmer's toolbox and allow pattern matching. They are also used for manipulating text and data. This book will provide you with the know-how (and practical examples) to solve real-world problems using regex in Java.

You will begin by discovering what regular expressions are and how they work with Java. This easy-to-follow guide is a great place from which to familiarize yourself with the core concepts of regular expressions and to master its implementation with the features of Java 9. You will learn how to match, extract, and transform text by matching specific words, characters, and patterns. You will learn when and where to apply the methods for finding patterns in digits, letters, Unicode characters, and string literals. Going forward, you will learn to use zero-length assertions and lookarounds, parsing the source code, and processing the log files. Finally, you will master tips, tricks, and best practices in regex with Java.

Table of Contents

Chapter 1: Getting Started with Regular Expressions
Introduction to regular expressions
Summary
Chapter 2: Understanding the Core Constructs of Java Regular Expressions
Understanding the core constructs of regular expressions
Quantifiers
Summary
Chapter 3: Working with Groups, Capturing, and References
Capturing groups
Non-capturing groups
Back references
Summary
Chapter 4: Regular Expression Programming Using Java String and Scanner APIs
Introduction to the Java String API for regular expressions' evaluation
Using regular expressions in Java Scanner API
Summary
Chapter 5: Introduction to Java Regular Expression APIs - Pattern and Matcher Classes
The MatchResult interface
The Pattern class
The Matcher class
Summary
Chapter 6: Exploring Zero-Width Assertions, Lookarounds, and Atomic Groups
Zero-width assertions
\G boundary assertion
Atomic groups
Lookahead assertions
Lookbehind assertions
Summary
Chapter 7: Understanding the Union, Intersection, and Subtraction of Character Classes
The union of character classes
The intersection of character classes
The subtraction of character classes
Why should you use composite character classes?
Summary
Chapter 8: Regular Expression Pitfalls, Optimization, and Performance Improvements
Common pitfalls and ways to avoid them while writing regular expressions
How to test and benchmark your regular expression performance
Catastrophic or exponential backtracking
Optimization and performance enhancement tips
Summary

What You Will Learn

  • Understand the semantics, rules, and core concepts of writing Java code involving regular expressions.
  • Learn about the java.util.Regex package using the Pattern class, Matcher class, code snippets, and more.
  • Match and capture text in Regex and use back-references to the captured groups.
  • Explore Regex using Java String methods and regex capabilities in the Java Scanner API
  • Use zero-width assertions and lookarounds in regex
  • Test and optimize a poorly performing Regex and various other performance tips.

Authors

Table of Contents

Chapter 1: Getting Started with Regular Expressions
Introduction to regular expressions
Summary
Chapter 2: Understanding the Core Constructs of Java Regular Expressions
Understanding the core constructs of regular expressions
Quantifiers
Summary
Chapter 3: Working with Groups, Capturing, and References
Capturing groups
Non-capturing groups
Back references
Summary
Chapter 4: Regular Expression Programming Using Java String and Scanner APIs
Introduction to the Java String API for regular expressions' evaluation
Using regular expressions in Java Scanner API
Summary
Chapter 5: Introduction to Java Regular Expression APIs - Pattern and Matcher Classes
The MatchResult interface
The Pattern class
The Matcher class
Summary
Chapter 6: Exploring Zero-Width Assertions, Lookarounds, and Atomic Groups
Zero-width assertions
\G boundary assertion
Atomic groups
Lookahead assertions
Lookbehind assertions
Summary
Chapter 7: Understanding the Union, Intersection, and Subtraction of Character Classes
The union of character classes
The intersection of character classes
The subtraction of character classes
Why should you use composite character classes?
Summary
Chapter 8: Regular Expression Pitfalls, Optimization, and Performance Improvements
Common pitfalls and ways to avoid them while writing regular expressions
How to test and benchmark your regular expression performance
Catastrophic or exponential backtracking
Optimization and performance enhancement tips
Summary

Book Details

ISBN 139781787288706
Paperback158 pages
Read More

Read More Reviews

Recommended for You

JavaScript Regular Expressions Book Cover
JavaScript Regular Expressions
$ 27.99
$ 19.60
Writing High Performance Java Application in Java 9 [Video] Book Cover
Writing High Performance Java Application in Java 9 [Video]
$ 124.99
$ 106.25
Mastering Python Regular Expressions Book Cover
Mastering Python Regular Expressions
$ 14.99
$ 10.50
Advanced Data Structures and Algorithms in Java 9 [Video] Book Cover
Advanced Data Structures and Algorithms in Java 9 [Video]
$ 124.99
$ 106.25
Basic Data Structures and Algorithms in Java 9 [Video] Book Cover
Basic Data Structures and Algorithms in Java 9 [Video]
$ 124.99
$ 106.25
Java 9 Functional Data Processing [Video] Book Cover
Java 9 Functional Data Processing [Video]
$ 124.99
$ 106.25