Oct-22-2019, 04:13 AM
1. i need to match 2 possible forms of a file name. what i did was put one form on each side of a vertical bar ('|'). what i am wondering is how to deal with groups because one form has all 3 groups and the other form has only 2 groups. do i need to have the same number of groups on each side of the vertical bar? or can i use '()' to include a dummy group? or will the .groups() method just return a 3-tuple in one case and a 2-tuple if the other matches?
2. in my expression is a match group for a particular pattern, but if the string has more than one such pattern i want to match the last one and get whatever that pattern is in the string when calling .groups(). how can i be sure of that?
2. in my expression is a match group for a particular pattern, but if the string has more than one such pattern i want to match the last one and get whatever that pattern is in the string when calling .groups(). how can i be sure of that?