$ perl -e 'my $x=shift; print qq|$x\n|; print $x=~m/(\\[\\\w]+)/,qq|\n|' 'some \\text\with\backslashes and stuff' some \\text\with\backslashes and stuff \\text\with\backslashes