Extracting metadata from filenames with brackets

I am attempting to extract metadata from files generated by the GE Incell Analyzer which gives filenames in the form of:

C - 6(fld 1 wv TL - Bright field - open z 01).tif

The problem comes when writing the Regex for the filename, as when it hits the first “(” I cannot remove it as it thinks I’m opening up a new part of the expression.

I don’t really want to batch convert the filenames as I’m worried the Incell Analyzer won’t be able to read the files properly (also this would take a long time in itself as I have ~2Tbytes of data).

How can I extract the well column, well row, field and z stack level from the above filename?


You need to escape the parentheses with a backslash, i.e. ‘’ (no quotes). This is documented deep into our Metadata Help (at least it’s there – whew!):

For your example, this works for me:

.*\(fld (?P<Field>[0-9]) wv (?P<Wavelength>[A-Z]{2}) - (?P<Modality>.*) - (?P<Other_z_stuff>.*) (?P<Num_field>[0-9]{2})\).tif