Regular Expression Functions

Overview

This Plug-in exposes Java Regular Expression string manipulation capabilities as Appian Functions. Very useful for validation rules and data manipulation on interactive SAIL forms.  

Key Features & Functionality

Datatypes provided:

  • RegexMatch - has a string field representing the string found, a starting index for the string in the haystack and an ending index for the string in the haystack

Regex Flags supported:

  • i - case insensitive
  • g - find all matches
  • m - multiline search
  • s - treats the entire string as a single line
  • u - unicode aware search
  • x - ignores comments starting with '#' and white spaces
  • d - enables unix line mode

Functions provided:

  • regexSearch - Searches for the selected pattern with the specified regex options and returns a list of RegexMatch Datatypes, accepts all regex flags.
  • regexArraySearchIndexOfFirstMatch - Searches an array for a match and returns the first index of match found
  • regexMatch - Indicates whether the regular expression finds a match in the input string, accepts all regex flags.
  • regexInsertMatchMarkers - Finds the match or matches and surrounds them with starting and ending markers, accepts all regex flags.
  • regexFirstMatch - Returns the first match of the regular expression within the input string, accepts all regex flags except 'g'.
  • regexAllMatches - Returns all matches of the regular expression within the input string, accepts all regex flags.
  • regexReplaceAll - Replaces all matches of the regular expression within the input string
Anonymous
Parents
  • Good day!  Just starting to learn your product, but how can I get this Java REGEX into your regex function to return a result?

    List<String> ssns = new ArrayList<String>();
           
    //Valid SSNs
    ssns.add("123-45-6789");  
    ssns.add("856-45-6789");  
     
    //Invalid SSNs
    ssns.add("000-45-6789");  
    ssns.add("666-45-6789");  
    ssns.add("901-45-6789");  
    ssns.add("85-345-6789"); 
    ssns.add("856-453-6789"); 
    ssns.add("856-45-67891"); 
    ssns.add("856-456789"); 
     
    String regex = "^(?!000|666)[0-8][0-9]{2}-(?!00)[0-9]{2}-(?!0000)[0-9]{4}$";
     
    Pattern pattern = Pattern.compile(regex);
     
    for (String number : ssns)
    {
        Matcher matcher = pattern.matcher(number);
        System.out.println(matcher.matches());
    }
     
    Output:
     
    true
    true
     
    false
    false
    false
    false
    false
    false
    false

  • Hello! For that you should use regexmatch. Just put the pattern in the first argument and the string you want to check in the second argument. To duplicate that more closely just loop through the list.

Comment Children
No Data