I have the following regexp (using Python syntax):
(\d+)x(\d+)(?:\s+)?-(?:\s+)?([^\(\)]+)(?:\s+)?\((\d+)(?:(?:\s+)?-(?:\s+)?([^\(\)]+))?\)(?:(?:\s+)?\(([^\(\)]+)\))?(?:(?:\s+)?-(?:\s+)?([^\(\)]+) \((\d+)\))?
It matches strings which fit one of the following forms:
21x04 - Some Text (04)
6x03 - Some Text (00 - Some Text)
6x03 - Some Text (00 - Some Text) (Some Text)
23x01 - Some Text (10) - Some Text (02)
The numbers and text vary, and are captured. However, the spacing is not always consistent, so it is designed to allow for any number of spaces.
Is there a way of simplifying it - I'm not necessarily asking for someone to do this for me, just to tell me if there are tools (a Google search yielded a few results, but none of them could handle it), or a systematic method of doing this.
Or can anyone see a better regex that fits this scenario?