public void test(IDocument doc, IProcessingCallback Processing) { Processing.ReportMessage("Setting fc_Predefined:InvoicePredefinedVendorId from import folder..."); IPage page = doc.Pages[0]; string path = page.ImageSource; string pattern = @"\[(.*?)\]"; Match m = Regex.Match(path, pattern, RegexOptions.IgnoreCase); Processing.ReportMessage("Testing RegEx..."); if (m.Success) { string BUid = m.Groups[1].Value; Processing.ReportMessage("Regex succesfull, setting " + BUid + " as the BU ID!"); doc.Properties.Set("fc_Predefined:InvoicePredefinedVendorId", BUid); } else { Processing.ReportWarning("Could not detect BU ID :-("); } }