меня заинтересован только в python-regex-pattern, я надеюсь, что один из вас может помочь мне < /p>
У меня есть текст ввода Folloing (множество строк с \ n < /code>, поскольку север-север, сжатый на '.
Код: Выделить всё
.
.
1 Order
order1 stuff
order1 stuff
etc
ShippingMethod: Truck
.
.
2 Order
order2 stuff
order2 stuff
etc
ShippingMethod: Truck
.
.
Order Summary
.
.
Код: Выделить всё
pattern = \d\s*Order + [.|\s|\S]* + Truck
Когда я выполняю это совпадение, я получаю один результат, начиная с 1 порядка и остановки на Second Truck :
Код: Выделить всё
1 Order
order1 stuff
order1 stuff
etc
ShippingMethod: Truck
.
.
2 Order
order2 stuff
order2 stuff
etc
ShippingMethod: Truck
1 Order
order1 stuff
order1 stuff
etc
ShippingMethod: Truck
< /code>
2 Order
order2 stuff
order2 stuff
etc
ShippingMethod: Truck
< /code>
I hope it's clear what I am looking for. Any help is greatly appreciated.
Thanks in advance, stay safe, stay healthy!
Things you might suggest:
- You have to assume varying amounts of Whitespaces at the start of a line and in between words, since the input text is the result of a PDF-text-extractor. But \n can be trusted. Basically insterad of writing \n write \s*\n
- I can't use "Order" as the end-part of the pattern, since after the last order the next thing is a summary.
- "ShippingMethod" is different in my language, that's why I used "Truck" for this example here. I will manage to rewrite.
Подробнее здесь: https://stackoverflow.com/questions/665 ... ne-matches