问题
I have to split an email that is received everyday, with a set of rules. This is an example of the email:
A N K U N F T 11.08.15
*** NEUBUCHUNG ***
11.08.15 xxx xxx X3 2830 14:25 17:50
18.08.15 xxx xxx X3 2831 18:40
F882129 dsdsaidsaia
F882129 xxxyxyagydaysd
**«CUT HERE»**
A N K U N F T 18.08.15
*** NEUBUCHUNG ***
11.08.15 xxx xxx X3 2830 14:25 17:50
18.08.15 xxx xxx X3 2831 18:40
F881554 ZXCXZCXCXZCCXZ
F881554 xcvcxvcxvcvxc
F881554 xvcxvcxcvxxvccvxxcv
**«CUT HERE»**
11.08.15 xxx xxx X3 2830 14:25 17:50
18.08.15 xxx xxx X3 2831 18:40
F881605 xczxcdfsfdsdfs
F881605 zxccxzxzdffdsfds
**«CUT HERE»**
So it basically has to be cut whenever the last F999999 appears ( where 9 can be any number). How can I do this?
回答1:
You could try this, though splitting on \n\n
would work as
(?:\sF\d+.*?\n\n)\K(\n)
Split on the capture group.
Regex101
来源:https://stackoverflow.com/questions/32012237/php-split-email-with-rules