in reply to selecting characters from a variable
The ^([^:]*): captures all of the non-colon characters ([^:]*) from the start of the line (^) until the first colon and places it in $1.$LINE =~ /^([^:]*):[^:]:[^:]:[^:]:([^,:]*)/; $up_to_first_colon = $1; $fourth_colon_to_next_comma = $2;
Each [^:]: skips over a group of non-colon characters, ending with a colon.
Finally, ([^,:]*) captures the group of non-colon, non-comma characters following the fourth colon and places it in $2. (Change it to ([^,]*) if the second field should only be terminated by a comma and not by a colon.)
|
|---|