You are viewing limited content. For full access, please sign in.

Question

Question

Regular Expression Needed to Remove Items at End of String

asked on March 19, 2017

I have a set of vendor names that all have *FLC at the end of them by design to differentiate the way their AP process is handled from all other vendors.  I need to run a repository search inside a workflow using the vendor token, but the files it will be looking for do not have the *FLC at the end of their names.  For this reason, I need a regular expression (or something else) that will work to remove the *FLC from the end of the vendor name token.  It is separated from the vendor name by a space as well.  

Example:  Sample Vendor *FLC

Folder name I will be locating in the search:  Sample Vendor

I've tried a few things, but can't figure this out.  We are running Laserfiche 10.1, and Workflow 10.  Any help would be appreciated.

Thanks!

0 0

Answer

SELECTED ANSWER
replied on March 19, 2017

Hi Melanie, this should do the trick:

(.*)? \*FLC$

A breakdown of the syntax:

  • ( ... ) : specify the character set to match and capture
  • .* : match any amount of any character
  • ? : non-greedy specifier; because we're matching any character, we use this to make sure we don't inadvertently match any character. For this particular pattern, it's not strictly necessary but I find it good practice whenever using .* in the pattern.
  •  \*FLC : the pattern to identify at the end of the string; note that we use \* to escape the asterisk
  • $ : match the end of the string. This will make sure if, on the off chance that there's a " *FLC" somewhere that you do want to capture, that it indeed gets captured.

Hope this helps!

PatternMatch.png
PatternMatch.png (13.32 KB)
3 0
replied on March 20, 2017

Thank you so much for a perfectly explained answer!  This worked great, and it helped me to understand more about how these items work in combination.  

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.