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

Question

Question

Cleaning up name to do a query?

asked on September 5, 2014

 So I'm trying to query a table based upon the name of a document, however, I need to clean up the documents name first as the names when I bring into Laserfiche are renamed with the (1), (2), etc.  Below is what the document names look like...so I'm trying to find out if 1) Do I need to clean them up first and if that can be automated so that I can drop the _2, _3, etc. and the (1), (2), (3).  So documents can have numbers in the name, but never with the underscore or parenthesis or can I do some type of query that matches part of the entry name and the page count?

0 0

Answer

SELECTED ANSWER
replied on September 9, 2014

That's odd, it works for me.

 

Could it be a version issue? We're running Workflow 9.1.1.365.

0 0

Replies

replied on September 5, 2014

Another (simpler) regex that will remove your extra characters:

([^_(]+).*

Match anything but underscore or open parenthesis one or more times followed by zero or more characters.

 

The base file name should be stored into the first capture group.

 

This does assume that there are no underscores or parentheses anywhere in your file names. You can add characters to the negated character class to include other characters that will never appear in your file names (perhaps period?). The regex does capture trailing spaces, but that can be fixed either by altering the regex slightly or running the file names through a string trim.

1 0
replied on September 5, 2014 Show version history

You can do a single regular expression that will return the "core" document name.

(.+)(?=_\d+|\s\(\d+\))|(.+)(?!_\d+|\s\(\d+\))

Here's a description of what it's doing:

 

In my tests this strips off (1) and _1 and leaves the rest of the string intact.

0 0
replied on September 8, 2014

Devin,

For whatever reason, I cannot get the "31" in the following name to appear which is breaking one of my queries:  11030 plans tif Created 3 6 2013 9 18 31.

 

The Regex you provided is working great...but doesn't pick up the 31?

 

Thanks!

0 0
SELECTED ANSWER
replied on September 9, 2014

That's odd, it works for me.

 

Could it be a version issue? We're running Workflow 9.1.1.365.

0 0
replied on September 9, 2014

Got it...I had a (?=\s+\d+| instead of (?=_\d+|

 

Thanks!!

0 0
replied on September 9, 2014

Hi Daryl, 

 

If your question has been answered, please let us know by clicking the "This answered my question" button on the appropriate response.

 

If you still need assistance with this matter, just update this thread. Thanks!

0 0
replied on September 9, 2014

I'm still having some issues with the Regex which is why I did updated the thread.  Thanks

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

Sign in to reply to this post.