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

Question

Question

Routing decision by an specific regular expression

asked on October 26, 2016 Show version history

I got this case:

The name of the document tells me the type of document and based on that i take decisions on my workflow. The naming structure is different for each type of document.

I got 6 types of documents and I need each one of them take a different routing decission. The last branch (7) is if you do not fall into any of the above patterns I move the document to a route for manual review.

From the 6 possible documents  5 of them present no problem to me because there is something really clear inside of the name that let me know the type of the document.

The one is gaving me trouble is this syntax:

Permit Name_Name of the store_CR of the Store

Right example (Uso de Suelo_Universidad_50UNI)

Wrong that doesnt fit the other criteria (Visto Bueno Operatividad Proteccion Civil_2015__Zaragoza_50FCJ)

Everything that doesnt fit this exact pattern or the other ones got to go to the last branch.

I just cant find any regular expression that serves the route decision to work as i need.

 

Anyone have any ideas?

 

 

 

 

0 0

Answer

SELECTED ANSWER
replied on October 26, 2016

#2, #3, and #6 should be something like ^[^_]+_LETTERSGOHERE_[0-9]{4}_[^_]+_[^_]+$ to account for the whole string being text_letter_year_text_text (where [^_]+. defines the text as "anything but an underscore").

#4 would be similar, but without the year.

#5 would have an extra group of 2 digits for the month: ^[^_]+_LETTERSGOHERE_[0-9]{4}_[0-9]{2}_[^_]+_[^_]+$

#1 would be just 3 text groups and underscores: ^[^_]+_[^_]+_[^_]+$

0 0

Replies

replied on October 26, 2016

Your description isn't clear enough for me to understand what text you need to extract, and which text you need to match, but I can point you to a good resource for building regular expressions.

I never use the regex tool built into Laserfiche, as it's too time consuming and awkward. This is the best resource I've found for regex:

https://regex101.com/

Put the text you'll be getting in the text string window, and then build and test your regex on the web page, which will update every time you make a change instead of having to click on a series of buttons every time you want to test. There's also a nice cheat sheet on the lower right of the page.

0 0
replied on October 26, 2016

Hi Glen

 

I can extract what I need to extract from the name once I identified the document because I can give a unique treatment to each, thats not my problem. My problem is that this is for a massive import to a one Inbox in LF and I need to first identify what type of document that I'm trying to process.

And for this decision I need the name structure will always be exactly that way for this type of document, and if not, then goes to the last branch.

The others did not represent problem to be identified because they are so transparent like name contains _R_ or name contains _P_ or name contains _CP_.

This one is: text(with possible blanks in the middle)_tex(with possible blanks in the middle)_text

 

So As I put in the upper example (maybe i put wrong the example): Visto Bueno Operatividad Proteccion Civil_2015__Zaragoza_50FCJ

Its an example of something that doesnt fit in any of the type of documents. So I need it to go for the 7 branch.

0 0
replied on October 26, 2016

So things with 2 underscores (_) are good and things with 3 underscores are bad?

0 0
replied on October 26, 2016 Show version history

Hi Miruna

One underscore, but no only that, if you see that example has 4 texts

"Visto Bueno Operatividad Proteccion Civil_2015__Zaragoza_50FCJ"

One of the keys in all the possible documents type are the "_" Those are the spacers.

This are all the posibilitys for my routing decision:

1.- text(with possible blanks in the middle)_tex(with possible blanks in the middle)_text(number and letters)

2.- text(with possible blanks in the middle)_R_####(Year)_text(with possible blanks in the middle)_text(number and letters)

3.- text(with possible blanks in the middle)_P_####(Year)_text(with possible blanks in the middle)_text(number and letters)

4.- text(with possible blanks in the middle)_S_text(with possible blanks in the middle)_text(number and letters)

5.- text(with possible blanks in the middle)_PR_####(Year)_##(Month)_text(with possible blanks in the middle)_text(number and letters)

6.- text(with possible blanks in the middle)_RE_####(Year)_text(with possible blanks in the middle)_text(number and letters)

7.- None of the above

 

0 0
replied on October 26, 2016

If I'm reading this right, it sounds like the problem is that the first branch also catches things with 3 underscore?

The patterns in your first 6 branches should start with ^ and end with $ to indicate that the whole string needs to match. That way, the first branch will no longer catch "Visto Bueno Operatividad Proteccion Civil_2015__Zaragoza_50FCJ".

The first possibility you're listing should be 6th to give the other ones, which are more restrictive, a chance to look for a match first. That way you wouldn't have to worry about making your pattern restrictive enough to account for blanks.

0 0
replied on October 26, 2016

From 2 to 6 i only use a Entry: Name::Starting Entry contains "_The letter(s)_" for the routing, then inside of the branch I make a pattern matching for each case.

But in the 1 I cant find a formula that works only for the exact match, no even with the start with ^ and end with $

0 0
SELECTED ANSWER
replied on October 26, 2016

#2, #3, and #6 should be something like ^[^_]+_LETTERSGOHERE_[0-9]{4}_[^_]+_[^_]+$ to account for the whole string being text_letter_year_text_text (where [^_]+. defines the text as "anything but an underscore").

#4 would be similar, but without the year.

#5 would have an extra group of 2 digits for the month: ^[^_]+_LETTERSGOHERE_[0-9]{4}_[0-9]{2}_[^_]+_[^_]+$

#1 would be just 3 text groups and underscores: ^[^_]+_[^_]+_[^_]+$

0 0
replied on October 27, 2016

I think I had never used this expression [^_]

You gave me a lot to think.

Thanks a lot Miruna.

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

Sign in to reply to this post.