SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

REGEX / NOTES</>↗
Regex03 Nov 2010

How do I use capturing groups in regex?

Capturing groups are a way to treat multiple characters as a single unit. They are created by placing the characters to be grouped inside a set of parentheses. For example, the regular expression (dog) creates a single group containing the letters d, o and g. Regular expressions can also define other capturing groups that correspond […]

Wayan · 2 min read
REGEX / NOTES</>↗
Regex02 Nov 2010

How do I use logical OR operator in regex?

You can use the | operator (logical OR) to match characters or expression of either the left or right of the | operator. For example the (t|T) will match either t or T from the input string. package org.kodejava.regex; import java.util.regex.Matcher; import java.util.regex.Pattern; public class LogicalOrRegexDemo { public static void main(String[] args) { // Define […]

Wayan · 1 min read
REGEX / NOTES</>↗
Regex02 Nov 2010

How do I use predefined character classes regex?

In regex, you also have a number of predefined character classes that provide you with a shorthand notation for commonly used sets of characters. Here are the list: Predefined Class Matches . Any character d Any digit, shorthand for [0-9] D A non digit, [^0-9] s A whitespace character [^s] S Any non whitespace character […]

Wayan · 1 min read
REGEX / NOTES</>↗
Regex02 Nov 2010

How do I do boundary matching in regex?

If you want to find the occurrence of a pattern in more precise position, for example at the beginning or the end of line, you can use boundary matcher. Boundary matcher are special sequences in a regular expression when you want to match a particular boundary. Here are the list: Matcher Matches ^ The beginning […]

Wayan · 2 min read
REGEX / NOTES</>↗
Regex31 Oct 2010

How do I write union character class regex?

To create a single character class comprised of two or more separate character classes use unions. To create a union, simply nest one class inside the other, such as [0-3[7-9]]. package org.kodejava.regex; import java.util.regex.Matcher; import java.util.regex.Pattern; public class CharacterClassUnionDemo { public static void main(String[] args) { // Defines regex that matches the number 0, 1, […]

Wayan · 1 min read
REGEX / NOTES</>↗
Regex31 Oct 2010

How do I write character class intersection regex?

You can use the && operator to combine classes that define a sets of characters. It will only match characters common to both classes (intersection). package org.kodejava.regex; import java.util.regex.Matcher; import java.util.regex.Pattern; public class CharacterClassIntersectionDemo { public static void main(String[] args) { // Define regex that will search characters from 'a' to 'z' // and is […]

Wayan · 1 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.