Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Object-Oriented Programming with Kotlin

You're reading from   Hands-On Object-Oriented Programming with Kotlin Build robust software with reusable code using OOP principles and design patterns in Kotlin

Arrow left icon
Product type Paperback
Published in Oct 2018
Publisher Packt
ISBN-13 9781789617726
Length 370 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Abid Khan Abid Khan
Author Profile Icon Abid Khan
Abid Khan
Igor Kucherenko Igor Kucherenko
Author Profile Icon Igor Kucherenko
Igor Kucherenko
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Getting Started with Kotlin FREE CHAPTER 2. Introduction to Object-Oriented Programming 3. The Four Pillars of Object-Oriented Programming 4. Classes - Advanced Concepts 5. Data Collection, Iterators, and Filters 6. Object-Oriented Patterns in Kotlin 7. Coroutines - a Lightweight Thread? 8. Interoperability 9. Regular Expression and Serialization in Kotlin 10. Exception Handling 11. Testing in Object-Oriented Programming with Kotlin 12. Assessments 13. Other Books You May Enjoy

Kotlin and regular expression

In Kotlin, regular expressions are represented by the Regex class from the kotlin.text package. Instances of this class are immutable, and we can create a new one by using one of the following constructors:

public actual constructor(pattern: String) : this(Pattern.compile(pattern))

public actual constructor(pattern: String, option: RegexOption) : this(Pattern.compile(pattern, ensureUnicodeCase(option.value)))

public actual constructor(pattern: String, options: Set<RegexOption>) : this(Pattern.compile(pattern, ensureUnicodeCase(options.toInt())))

RegexOption is an enum that we can use to specify any additional options. This defines the following objects:

  • IGNORE_CASE: You can use this if you need to ignore a string
  • MULTILINE: This is a line terminator or the end of the input sequence, and it must be used just after or just before ^ and $ subexpressions...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image