/ # start of pattern match ( # begin storing into $1 .* # store any number of any character... - # ...followed by a hyphen... ( # begin storing into $2 \d # ...any digit... + # ...as many as we can grab... ) # stop storing into $2 - # ...followed by another hyphen .* # ...followed by any number of any character... ) # stop storing into $2 $ # end of the line, bub /x; # / to terminate regex, x to allow comments