Wednesday, 14 August 2013

Regular expression for repeated pattern across multiple line [on hold]

Regular expression for repeated pattern across multiple line [on hold]

ABC1
PQR1
XYZ1
XYZ2
XYZ3
ABC2
PQR2
XYZ4
XYZ5
ABC3
PQR3
XYZ6
XYZ7
XYZ8
XYZ9
I want to split the above text using regular expression such that the
output contains 3 matches. Line starts with ABC till the next occurrence
of ABC is a match. so the output should be something like this. First
match:-
ABC1
PQR1
XYZ1
XYZ2
XYZ3
Second match:-
ABC2
PQR2
XYZ4
XYZ5
and third match:-
ABC3
PQR3
XYZ6
XYZ7
XYZ8
XYZ9

No comments:

Post a Comment