Quantcast
Viewing all articles
Browse latest Browse all 14069

How to create a regular expression to partition a string that terminates in either ": 45" or ",", without the ": " [closed]

The strings are of the form:

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

The result of the search should produce4 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?


Viewing all articles
Browse latest Browse all 14069

Trending Articles