perl - Regex - match up to next match -
i iterate matches on text, blocks want match start number tab character.
my beginning match ^\d+\t, there way indicate want text including match until next match?
input data:
1 111.111.111.111 111.111.111.111 host ip 111.111.111.111 111.111.111.111 111.111.111.111 host ip tcp app 11111, 11111, 11111, 11111 allow 2 111.111.111.111 111.111.111.111 111.111.111.111 host ip 111.111.111.111 111.111.111.111 host ip tcp app 11111, 11111, 11111, 11111 allow 3 111.111.111.111 111.111.111.111 host ip 111.111.111.111 111.111.111.111 111.111.111.111 111.111.111.111 host ip tcp app 11111, 11111, 11111, 11111 allow 4 111.111.111.111 111.111.111.111 111.111.111.111 111.111.111.111 host ip 111.111.111.111 111.111.111.111 host ip tcp app 11111, 11111, 11111, 11111 allow i'm using perl.
the following regex should want:
^\d+\t(?:[^\d]+|[\d]+(?!\t))* this match number of digits followed tab, , number of non-digits or digits not followed tab.
my @matches = $data =~ /^\d+\t(?:[^\d]+|[\d]+(?!\t))*/mg; edit: okay 1 should work!
Comments
Post a Comment