The JADE 2022 release meets tomorrow’s business demands.
The proposal is to provide a Pattern Matching API be added to the JADE product. This would be provided as a set of JADE classes.
A key objective of the proposal is:
To make it easier for developers by reducing the amount of hand rolled string parsing and manipulation code.
To provide powerful and useful utility methods based on standard pattern matching techniques.
Allow developers to leverage standard patterns such as for email validation.
Use of this feature should improve the long-term read-ability and test-ability of JADE code.
Pattern based Find e.g finding a number e.g 3.14
Pattern based Match e.g check that a credit card number is of the correct format
Pattern based Splitting e.g splitting a string based on a set of delimiters or pattern
Pattern based Replacing e.g. replacing \\\\ with // in a directory path
Access to captured groups, if required
Case and case insensitive capability, for when case matters
Word boundary and other regex anchors
Multiple line operations for large bodies of text
API support for returning first only or all occurrences from an operation
Work with both ANSI and Unicode versions of JADE
Probably based on the PCRE library dialect
A double API is proposed:
First a simple Type Method based one for one off simple operations
JadeRegex@isMatch( text:String; pattern:String; ignoreCase:Boolean; options:Integer64):Boolean;
e.g. isDecimal := JadeRegex@isMatch("3.14", "\\d+\\.d+", false, Option_None);
A second fuller one requiring more programming overhead for repeated and complicated operations
JadeRegexPattern::compile(pattern:String; ignoreCase:Boolean; options:Integer64);
regexPattern : RegexPattern;
regexPattern.compile("\\d+\\.d+", false, Option_None);
isDecimal := regexPattern.isMatch("100.0");
The JADE Regex Library shall consist of several RootSchema classes.
JadeRegex: Simple Type method only API
JadeRegexPattern: A compiled regex pattern
JadeRegexResult: An iterable result of matches, essentially an array of match tuples
JadeRegexMatch: An individual match tuple giving rich information about a match.
Has properties: value, length, position, index.
JadeRegexCapture: An individual capture group tuple giving rich information about a capture, effectively a sub-match. Has properties: value, length, position, index.