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 Comment
  • Hi Pietro,

    Adding groups has been on my radar for a little while now, and I would like to get them added in the future. Unfortunately, I don't have a timeline on that for you at the moment. As for the modern languages, what are you looking for as far as that's concerned?

    Thanks,

    Chris

Children
  • Hey Chris,

    Grouped sub-expressions and reference of them in regex is a very crucial functionality. I need it for regexSearch().  Without it, that call is pretty useless.  I get back the entire matched string including the pattern and not just the grouped subexpressions.  Trying to parse the result matched string using extract() and other string functions is very difficult, especially when there are so many variations of the string I have to parse for.

    Maybe my memory fails me.  But, I could have sworn I've used regex plugin back in 2011 and 2015 where I did get back grouped sub-expressions in my regex search.

    Is there any way you can make this a higher priority item?

    Thanks.

    Brian

  • Hi Chris

    Just adding a +1 to Pietro's request, since we're looking for this functionality as well in our project. 

    Kind regards