The strings are of the form:

Item 5. Some text: 48
Item 5E. Some text,

The result of the search should produce 4 groups as follows.

Group(1) = "#"
Group(2) = "5" or "5E"
Group(3) = "Some text"
Group(4) = "48" or ","

I have tried:

r"(.*)Group (.*)\.(.+)(?::(.+))|(,)"
r"(.*)Group (.*)\.(.+)(?:(?::(.+))|(,))"
r"(.*)Group (.*)\.(.+)(:(.+))|(,)"

It have tried a variety of ways to solve this, but none work as required. What should the regular expression be?

0

There are 0 answers