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
  • Hey Chris,

    In function regexSearch(), do you support returns of the matches with each sub-expression captures broken out?  Currently, in the pattern, if I have multiple parenthesized sub-expressions, I get all the matches back in one matches array list with one entry and none of the sub-expression captures are broken out.  Just one big run on of what the entire pattern would have matched true if I were using simply regexMatch().

    I don't want a boolean back or the entire string that it matched on.  That's more work to then parse that out yet a second time.  I need the individual captures of each parenthesized sub-expressions returned back from regexSearch().

    I am on the Appian Cloud version 21.4 using the regexp plugin 2.1.2.

    Thanks.

Comment
  • Hey Chris,

    In function regexSearch(), do you support returns of the matches with each sub-expression captures broken out?  Currently, in the pattern, if I have multiple parenthesized sub-expressions, I get all the matches back in one matches array list with one entry and none of the sub-expression captures are broken out.  Just one big run on of what the entire pattern would have matched true if I were using simply regexMatch().

    I don't want a boolean back or the entire string that it matched on.  That's more work to then parse that out yet a second time.  I need the individual captures of each parenthesized sub-expressions returned back from regexSearch().

    I am on the Appian Cloud version 21.4 using the regexp plugin 2.1.2.

    Thanks.

Children
No Data