"READ: \S+ (/[^/]+)*/(?<filename>[^\s/]+) Rex is about compromises. I have to make a few assumptions based on the illustrated sample data. "READ:" is perhaps a keyword and doesn't change from event to event. "*MDTM" is perhaps a classifier that may take different forms but that does not contain space. (\S) The path before file name is absolute, and can vary in depth. (See below.) File name contains no space. ([^s]) By convention, file name also does not include a path separator. (Combined with no space, that's [^\s/]) After file name, there is either a space or end of the line. The expression contains two different repetition tokens. + means repeat at least once, up to any number of times. * means repeat zero to unlimited times. Parentheses in standard regex is just grouping. So, (/[^/]+)* matches /abc, /abc/def, /abc/def/ghi; but (/[^/]+)* zero-length string, so (/[^/]+)*/ also matches /. Hope this helps.
... View more