Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
What regex will match these lines?
import re data = ''' 12, 16:00:30, P , 14, ______________ ABC12345678 , N, JOE B'obby, MY COMPANY-23 / NAME, 23, , 212, 14:00:30, , 212, ______________ ABC12345678,NCh , BOB Joe Joe, MY NAME, 300, 12, 2, 13:00:30,P , 2, ______________ ABC12345678,, BOB Joe °,,,, 20 3, 15:15:00, P, 132, ______________ ABC12345678,, PHO Guy Guy °,,,, ''' rx = re.compile(r''' ^ \ *(\d+)\ *, \ *(\d+:\d+:\d+)\ *, \ *(P?)\ *, \ *(\d+)\ *, \ *([^,]+?)\ *, \ *([^,]*?)\ *, \s*([^,]+?)\ *, \ *([^,]*?)\ *, \ *(\d*)\ *, \ *(\d*)\ *, \ *(\d*)\ * $ ''', re.M | re.X) for m in rx.finditer(data): print(tuple(g for g in m.groups()))
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
StringManipulation
find x with f(x) = 0 (limited area of solution)
Partition To 2 Equal Sum Subsets From An Array of Integers
31 dec string
Ваня и забор
Game4
molecular mass
Calender 2019
Decimal, Octal, Hexadecimal and Binary Format
inverse matrix gauss jordan
stackse - search stackoverflow differently
Please log in to post a comment.