Is there any way to break a string at defined position of a pattern by using perl split function? For example, by using @array=split(/pattern/, $string) one gets array of split $string but parts of string defined by pattern are missing in that array. Is it possible to specify which position of a pattern to split at, such that all pieces of initial $string are contained in @array?
Is there any way to break a string at defined position of a pattern
Share
From your example it looks like you want to split at a point, say, after
tgand beforegg.Because
splituses a regular expression you can use look-around assertions.Read about them under Extended Patterns in perlre
For example
output