P
P
PunKHS2015-10-17 23:48:53
Python
PunKHS, 2015-10-17 23:48:53

How to implement group repetition in regular expression?

There is the following text:
*********
test
123
aaa
234
345
*********
test
*********
test
222
111
*********
pattern: ^(?:\*{5,})$[\W|\w]+?(\d+$)[\W|\w]+?^(?:\*{5,})$
But only the first digits (123 and 222), respectively, fall into the group.
Please tell me how to do it. so that for each match with the pattern in the output, you can get all the numbers?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2015-10-18
@PunKHS

1) you get the text between the asterisks, as already written
2) you throw out the lines that do not contain numbers
between 1 and 2, you can generally sort line by line

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question