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

Question

Question

Pattern Matching in Workflow

asked on March 29, 2022 Show version history

I am trying to isolate ABBY COURT from a folder path and I am close, but I just can't get rid of the tail end.  What am I missing?

PM.JPG
PM.JPG (37.76 KB)
0 0

Replies

replied on March 29, 2022

Your expression is a little bit generic (and actually too specific, too, sometimes), but it may be sufficient depending on your context (e.g., your repository folder organization and what you're trying to match).

Currently, it'll match any 2 word folder name that follows a one letter folder name.  And it'll actually match a bunch of other things, too, since you're using \W (any non-word character) instead of something more specific like \\ (backslash literal).  And it *won't* match a 3 (or more) word folder name after the single letter folder (e.g., "Abby Superior Court" would not be captured), nor will it match a name that contains apostrophes or periods or other common symbols.

You may want something more like this:
\\[A-Z]\\([^\\]+)\\

(this matches a single letter path followed by everything between the next two backslashes, by using a character class that says "match everything except a backslash")

Disclaimer: it's difficult to create a robust pattern with only one example--ideally you should test this pattern on dozens of different examples.

1 0
replied on March 29, 2022

I did run into that problem because of course there are street names with more than two words in it.  Thank you and I will test your pattern out!

0 0
replied on March 29, 2022

Nicholas,

If your folder path is consistent you could also split the path on the  '\' character and pull out the 5th value;

1 0
replied on March 29, 2022

That's a good idea, I will test this out.  Thank you!

0 0
replied on March 29, 2022

Actually, I think I got it.  I removed the .* and went with:

 

\W\w\W(\w*\s\w*)\W

 

If there is a better or more efficient pattern, please let me know!

 

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

Sign in to reply to this post.