I have the following code that runs through and strips the data in the current column and creates a secondary column with just the code in parentheses and this works wonderfully
You may use
df['Folder Path'].str.extract(r'\((?!\d{4}-\d{2}\)|Data Only\))([^()]*)\)',expand=True)
The regex matches
\(
- an open parenthesis(?!\d{4}-\d{2}\)|Data Only\))
- a negative lookahead that fails the match if there is
\d{4}-\d{2}\)
- 4 digits, hyphen, 2 hyphens, )
|
- orData Only\)
- Data Only)
substrinbg([^()]*)
- Group 1: any 0 or more chars other than open/close parentheses
\)
- a close parenthesisSee the regex demo.