in reply to Re: regex'ing source code
in thread regex'ing source code

Ah, that missing tidbit of info!

After the post, it dawned on me about using split. But then I realized that split spits out the split phrase. I never knew about the paren expression before. So much still left to learn about Perl.

Thanks for the example!

Replies are listed 'Best First'.
Re^3: regex'ing source code
by muba (Priest) on Jun 29, 2012 at 03:47 UTC

    Well, even if split didn't had that handy bit of also returning the things it captured, you could've gone my @parts = $line =~ m/(\t|[^\t])/g;, which does essentially the same. With that regex you tell perl, "gimme an array of all tabs and all sequences of non-tabs."