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

Question

Question

Street number occurring right before file extension separated by white space

asked on May 1, 2018 Show version history

Hi there,

I'm fairly new to workflow and haven't tried pattern matching yet, but I have a project which asks me to parse out the strett number from a file name and assign it to a field value.  The file names look like this:

SR_A_G_ANDES DR 120.pdf

I'm trying to just parse out the street number, so only the numbers that occur right before the ".pdf".  They are separated from the rest of the file name by a white space that occurs right before the number.  I know that  (.*).pdf will get everything before the .pdf extension, but how do I make it stop at the white space that occurs directly before that number (like, everything to the left of the '.pdf' but stop at the first white space it gets to)? 

I've built a few workflows now, but this is my first foray into pattern matching, and I'm finding it challenging.  I will be looking into more training now for sure, but I really need to get this one off the ground. Can someone help?

edited: 

^SR_A_G_\w\s\w\s(\#+)

Would this work?

 

Thanks so much!

0 0

Answer

SELECTED ANSWER
replied on May 1, 2018

Is it only numeric data?  If so, you can use (\d+)\.[pP][dD][fF]

0 0
replied on May 1, 2018 Show version history

Yes, they files names are consistent in that a number always precedes the .pdf and that number is what I'm after.  There are no other number segments in the file name.

0 0
replied on May 1, 2018

The \d is for a numeric digit and the + behind it says to get as many in a row as there are.  The \. is because the period has a special meaning in Regular Expressions, and the back slash "escapes" the special meaning and makes it a plain period.  Then I allow for upper or lower case pdf.

0 0
replied on May 1, 2018

I tried your suggestion and it worked beautifully.  And I 'get' what you're saying.

 

Thank you!

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.