Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Releases: OpenNTF/regex4ls

regex4ls-1.1.1

21 Jan 16:16
Compare
Choose a tag to compare

Changes

This release addresses an issue reported here (German only) and reproduced by me on Domino 9.0.1FP3. The issue is probably caused by a Java update, see this IBM technote.

On some Domino versions, getting a handle on java.util.regex.Pattern.compile(String, int) from LS2J no longer works. An exception "LS2J Error: Threw java.lang.InternalError" is thrown.
You can, however, get the handle by iterating over all methods and selecting the desired one.
This release makes use of this workaround.

Apart from that, no functionality was added.

regex4ls-1.1.0

21 Jan 16:15
Compare
Choose a tag to compare

Changes

This release adds the RegexMatcher class.

RegexMatcher combines java.util.regex.Pattern and java.util.regex.Matcher into one handy LotusScript wrapper to perform Regular Expression operations on text.
You can do repeated matches on the same string with the find() method in order to locate multiple occurrences of pattern matches, and you can access captured groups with the group() function. The replaceAll() and replaceFirst() methods let you replace matching parts with strings that may contain backreferences to captured parts of the original string.

Whereas the SimpleRegexMatcher is targeted to users that are new to the java.util.regex classes, this class assumes a basic level of familiarity with the underlying Java classes.

Example Code

This example features capture groups and a backreference to the first capture group.

Dim Matcher As New RegexMatcher("My name is Presley. Elvis Presley.", "name is (\w+)\. (\w+) \1\.", 0)
If Matcher.find() Then
    ' This prints "Elvis Presley"
    Print Matcher.group(2) & " " & Matcher.group(1)
End If

Replace parts of the input using capture groups:

Dim Matcher As New RegexMatcher("From 10:00 To 12:00", "From (\d\d:\d\d) To (\d\d:\d\d)", 0)
' prints "10:00-12:00"
Print Matcher.replaceAll("$1-$2")

regex4ls-1.0.0

21 Jan 16:13
Compare
Choose a tag to compare

Changes

This initial release provides the LotusScript class SimpleRegexMatcher.

The SimpleRegexMatcher can determine whether a text matches a pattern.
In case of a match, it gives you access to the matching part of the text via its match property.

The Regular Expressions used in this class follow java.util.regex.Pattern syntax as described in
http://download.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html

Example Code

Search for an agent with licence to kill (00x):

Use "Regular Expressions"
Dim Matcher As New SimpleRegexMatcher
If Matcher.matches("James Bond is agent 007.", "\b00\d\b") Then
    ' This prints "found agent #007"
    Print "found agent #" & Matcher.match
End If