OpenNTF.org - Regular Expressions for LotusScript

My Links (Not logged in)
User Name Password
Rate This Project
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
Hosted by Prominic.NET

   Project: Regular Expressions for LotusScript (Managed by Harald Albers)
Actions:

Project Overview

Introduction
Categories

Rating:
Rating: 5 , Number of votes: 2 
Project Category:
Other 
Target Release:
R 8.0.x 
Primary Contact:
Harald Albers 
Team
Releases (last 3)
Chef(s):
Harald Albers
09/30/2010 - Regular Expressions for LotusScript (1.1.0)
09/29/2010 - Regular Expressions for LotusScript (1.0.0)

Total downloads (all releases): 495

Details

This project enables LotusScript developers to use Regular Expressions in their code.
It does so by providing a script library with simple wrappers around Java classes that are invoked by LS2J.
The wrapper classes behave like native LotusScript classes. All the clumsiness of JNI declarations that comes with using LS2J is abstracted away from the user.
 
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 original text via its Match property.
 
The 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 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.

In contrast to the SimpleRegexMatcher that is targeted to users new to the java.util.regex classes, RegexMatcher assumes a basic level of familiarity with the underlying Java classes.
 
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
 
Intended audience: LotusScript developers.
 
example code
    Use "Regular Expressions"

    ' This example searches for an agent with licence to kill.
    Dim Matcher1 As New SimpleRegexMatcher
    If Matcher1.matches("James Bond is agent 007.", "\b00\d\b") Then
        Print "found agent #" & Matcher1.Match  ' prints "found agent #007"
    End If
 

    ' Find name of someone who introduces himself in a James Bondish way.

    ' This example features capture groups and a backreference to the first capture group.
    Dim Matcher2 As New RegexMatcher("My name is Presley. Elvis Presley.", "name is (\w+)\. (\w+) \1\.", 0)
    If Matcher2.find() Then
        Print Matcher2.group(2) & " " & Matcher2.group(1' prints "Elvis Presley"
    End If

    ' Replace parts of the input using captured groups
    Dim Matcher3 As New RegexMatcher("from 10:00 to 12:00", "from (\d\d:\d\d) to (\d\d:\d\d)", 0)
    Print Matcher3.replaceAll("$1-$2"' prints "10:00-12:00"



Latest activity

Screenshots
Documentation



Feature Requests
Bugs



From the Project discussion
Testimonials


Project News



Check out other projects