in reply to A regex question...

I'd work backwards. The last step is obviously a join on "<br>". The step before that would be the insertion of dashes. The step before that would be splitting into fifteen-digit blocks. Hence:

$s = join '<br>', map { /(\d{5})(\d{5})(.*)/ && "$1-$2-$3" } ($s =~ /\d{15}/g);

    -- Chip Salzenberg, Free-Floating Agent of Chaos

Replies are listed 'Best First'.
Re: Re: A regex question...
by chip (Curate) on May 05, 2003 at 18:40 UTC
    Ah, I just noticed that it's not a string of arbitrary many fifteen-digit blocks, but just two. So artist has the better solution, for this problem.

        -- Chip Salzenberg, Free-Floating Agent of Chaos