Create Metadata from Filename

  • 8 August 2018
  • 2 replies
  • 0 views

Badge

Hi everyone

I have a workflow which creates metadata from the filename.  This is mostly simple just using Build String and counting characters.  I have a challenge though when trying to extract a customer name from the file name, for example: "Invoice 11111117 for Order 1011111 for Customer ACME International  Flavours Ltd.pdf" - this is due to customer names obviously not all being the same length so I cannot just count characters like I would to get the Invoice Number or Order Number as these are always fixed lengths at the same place in the file name.

Is there a way to get the customer name out, even though the character counts would be different for almost every file name?


2 replies

Userlevel 4
Badge +11

Hi,

if I've understood correctly, the first part (from Invoice to "for") has always the same length, in that case you can use an inline function to remove all the first character (the function ask as parameter the index of first char to be removed (0 in your case) and the number of character to be removed, and it will returns the remaining part of the string

Giacomo

Userlevel 5
Badge +14

use regular expression and you're not restricted with any part being of fixed or varying length

one like this should work

(?<=for Customer ).*(?=.w{3}$)

218977_pastedImage_2.png

Reply