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

Question

Question

Regular Expressions, what flavor of RegEx to use?

asked on July 8, 2022

I use regex101.com as my sandbox, mostly because I like it as a testing platform over the testing area given in the Workflow designer. However, I find that regular expressions I work out in the regex101 sandbox work there, but not in the Workflow environment. This makes me wonder, what flavor of RegEx does Laserfiche use? Knowing this can make it easier for testing using 3rd party tools.

I have several strings that have either a 4-digit, 6-digit or 8-digit date value in the file name. Aside from the fact that users had zero consistency in file names, I'm working on a workflow that extracts the date data from the file name and files it according (somepath/year/month/filename. I have it working, but I'm trying to optimize my workflow and use fewer pattern-matching tokens. 

I've found that I can use character classes: [a-zA-Z] to find values as in the example below:

However, if I try to use bracket expression character classes: [[:alpha:]], which should be the equivalent of the field constraints above, I get zero results.

This indicates to me that Workflow at least uses the .Net feature set for regular expressions, which does not support POSIX Bracket Expressions, Even though the alternative character classes are even listed in the Laserfiche documents: Helpful Regular Expressions for Repository Administration

I understand that the link above is talking about field constraints, but why would regular expressions work in one place, and not in others in the Laserfiche Univers? Is anyone able to confirm if Workflows use a different flavor of RegEx vs. what the rest of Laserfiche uses?

0 0

Answer

SELECTED ANSWER
replied on July 8, 2022

Hi Keith,

Workflow uses the .NET regex feature set as you noted.

My go-to online tester is Regex Storm .NET which as the name indicates, implements the .NET flavor.

Laserfiche Server may uniquely out of all Laserfiche components use a C++ regex library. I'm not 100% sure about that though.

2 0

Replies

replied on July 11, 2022

Thanks for the confirmation, Samuel. Having come from the Linux/MySQL world for many years, it'll be weird to get used to not using the full POSIX implementation of regular expressions. 

It seems that C++ uses the ECMAScript features as documented by Microsoft

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.