I currently have the following regex:
P:(?<ParentName>[A-Z,a-z,0-9,-,_]+)-(?<ParentAge>[A-Z,a-z,0-9,-,_]+)
C:(?<Child>[A-Z,a-z,0-9,-,_]+)
which matches with
P:Bob-30
C:Jane
However, I would like be able to express a regex matching with:
P:Jack-35
C:John
C:Marie
I tried this by adding []+ arround the second part:
P:(?<ParentName>[A-Z,a-z,0-9,-,_]+)-(?<ParentAge>[A-Z,a-z,0-9,-,_]+)
[C:(?<Child>[A-Z,a-z,0-9,-,_]+)]+
However this doesn't work and gives an error: 'unmatched parenthesis )'for the last parenthesis.
Anyone an idea how I can express this?
Thank you!
Update The problems seems to be the [] inside []. Working regex for only 1 "C:.."-line:
P:(?<ParentName>[A-Za-z0-9-_]+)-(?<ParentAge>[A-Za-z0-9-_]+)
C:[A-Za-z0-9-_]+\n
Not working regex for multiple "C:.."-lines:
P:(?<ParentName>[A-Za-z0-9-_]+)-(?<ParentAge>[A-Za-z0-9-_]+)
[C:[A-Za-z0-9-_]+\n]+
The first [ in the second line matches with the first ], while it should be the second ].