Help building a regular expression for use in split function?
I am a semi-new user to linux and could use some help building a regular expression for use in a split function.
Ok, so I have a perl script that contains an array like this:
@hostNames = (ABC123R:192.168.1.1, CBA321CBP:192.168.1.2, ZYX987R:192.168.1.3, etc...)
Where for example the first element "ABC123R:192.168.1.1":
ABC123R is the hostname and 192.168.1.1 is it's IPaddress.
I am trying to write a regular expression that will split the element with a '-' wherever there is a LETTER next to a NUMBER, like so:
I tried this expression below but am struggling with using regex for slightly complicated matching criteria:
for ($x = 0; $x < scalar(@hostNames); $x++)
$hostNames[$x] = split /([A-Z][0-9])/, "-"