Regular Expression Functions


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
  • 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?



  • I got it to work.  Here's an excerpt of my code in case anybody else is interested in escaping their regular expression pattern using regexReplaceAll() function.

    local!escapedPatternList: a!forEach(
        items: local!patternList,
        expression: fn!regexreplaceall(

  • Hey Chris,

    I'm trying to use regexReplaceAll() to escape the pattern string to make it safe for use with regexSearch().

    Unfortunately, I can't seem to make regexReplaceAll() function work.  I rather not use sustitute() function for each and every special characters in regular expression.

    In function regexReplaceAll(), the replacement string doesn't seem to support the regular expression substitution syntax.  I need to be able dynamically escape special characters and I can't seem to be able to dynamically escape characters I'm escaping.

    Let me know if there is a way to get it to work in using your library.  I'm trying to escape the usual suspects:

    ., +, *, ?, ^, $, (, ), [, ], {, }, |, \ (not including commas).

    Also, I remember using the regular expression plugin twice in the last decade and I remember that version was more like the industry standard regular expression function behavior, similar to one implemented in Java.  Am I wrong?  Also, could it be possible to be more of a transparent call to how the regular expression works in Java?


  • 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.


  • Thank you for the plugin. Very helpful!

  • Hello,

    The latest version does not use or import log4j at all. An older version did, but it did not include the library with the plugin and used the libraries available within the platform. So to ensure that you are covered you should ensure that the latest hotfix for your Appian platform has been applied, and that the latest version of the plugin is installed.



  • Hi Chris we have used this plugin in our application. In light of the recent discovery of vulnerabilities with log4j2, we would like to know if this plugin uses the affected version Log4j2, and if yes, would you release an updated version of this plugin to counter the exploit of vulnerability?

  • Hi Chris

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

    Kind regards

  • I'm not able to download the plugin. Maybe is due to MFA implemented in last days. I got the following error:

    {"resource":"\/suite\/rest\/a\/content\/latest\/isBCLGOdlMUpdGVqW3MCflN3nUZYkriSeIxPHq7TiecbApcLUg34lNQGJP8\/o","error":"APNX-1-4187-000","message":"Authentication failed. Please check your credentials and try again.","title":"An Error Has Occurred"}
  • Hi David,

    The defaulting to cases insensitive is to preserve backward compatibility. If you specify regex options as the final parameter for most of the functions it overrides the default. When using the functions check the description on the expression editor for the parameters.