How to add your knowledge

Regex

    Table of contents
    1. 1. Synopsis
    2. 2. Syntax
    3. 3. Usage

    Synopsis

    New ISL functions.

    Syntax

    • CreateRegex(regexSpec As String, Optional ignoreCase? As Boolean = true, Optional singleLine? As Boolean = true) As Any
    • RegexMatch?(testString As String, regex As Any) As Boolean

      regex can be:

      • string - in that case regex ignores casing, and single line.
      • object created by CreateRegex()

    Usage

    In design:

    Rule r As Any = createRegex("^[a-zA-Z0-9]\d{2}[a-zA-Z0-9](-\d{3}){2}[A-Za-z0-9]$")
    

    In Immediate window:

    Intent >RegexMatch?("0919-2893-1256", r)
    --> False
    Intent >RegexMatch?("A08Z-931-468A", r)
    --> True
    

    Or simplified:

    Intent >RegexMatch?("_A90-123-129X", "^[a-zA-Z0-9]\d{2}[a-zA-Z0-9](-\d{3}){2}[A-Za-z0-9]$")
    --> False 
    

    For case sensitive regex matching:

    Rule r As Any = createRegex("^a", ignoreCase? := False)
     
    Intent >RegexMatch?("A", r)
    --> False 
    

    .NET regex-related documentation:

    http://msdn.microsoft.com/en-us/library/hs600312.aspx

    http://msdn.microsoft.com/en-us/library/az24scfc.aspx