CORE API / CATATAN</>↗Core API05 Nov 2010
To make a thread begin its execution, call the start() method on a Thread or Runnable instance. Then the Java Virtual Machine will calls the run method of this thread. The snippet below is showing how to create a thread by implementing the Runnable interface. package org.kodejava.lang; public class ThreadRun implements Runnable { public static […]
REGEX / CATATAN</>↗Regex03 Nov 2010
A quantifier following a subsequence of a pattern determines the possibilities for how that subsequence of a pattern can repeat. Quantifiers allow you to specify the number of occurrences to match against. Quantifiers X? : X, once or not at all X* : X, zero or more times X+ : X, one or more times […]
REGEX / CATATAN</>↗Regex03 Nov 2010
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 […]
REGEX / CATATAN</>↗Regex02 Nov 2010
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 […]
REGEX / CATATAN</>↗Regex02 Nov 2010
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 […]
REGEX / CATATAN</>↗Regex02 Nov 2010
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 […]