Walt Mankowski on 28 Oct 2011 08:43:59 -0700 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [Philadelphia-pm] Perl one liner, regex capture group problem |
On Fri, Oct 28, 2011 at 11:14:56AM -0400, Kyle R. Burton wrote: > > command: curl -so- http://www.wikihow.com/Make-Easy-Homemade-Biscuits|perl > > -nE "say $1 if /src='(\S+(?:png|jpg))'/" > > abbreviated output: > > Stan, > > You may just be hitting shell replacement since the expression is in > double quotes - try backslashing the $1: > > ... perl -nE "say \$1 if /src='(\S+(?:png|jpg))'/" An alternative would be to enclose the perl in single quotes instead of double quotes. Then you don't have to worry about backslashing the $1, but you do need to backslash the single quotes: perl -nE 'say $1 if /src=\'(\S+(?:png|jpg))\'/' But unfortunately if you're on Windows then you can't use single quotes. so you'll need to use Kyle's solution. Walt
Attachment:
signature.asc
Description: Digital signature
_______________________________________________ Philadelphia-pm mailing list Philadelphia-pm@pm.org http://mail.pm.org/mailman/listinfo/philadelphia-pm