in reply to Reg Ex with quotes
Your problem is that you have used a char set where you intended a capture. The fixed (and simplified) regex looks like /("[^"]*")/.
use strict; use warnings; my @test; while (my $line = <DATA>) { if ($line =~ /("[^"]*")/) { my $keep = $1; push(@test,$keep); } } (print join "\n", @test) if @test; __DATA__ rmdir: directory "SAS_util0001000021A9_sasux101": Directory rmdir: directory "SAS_util000100002E19_sasux101": Directory rmdir: directory "SAS_util000100005891_sasux101": Directory
Prints:
"SAS_util0001000021A9_sasux101" "SAS_util000100002E19_sasux101" "SAS_util000100005891_sasux101"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Reg Ex with quotes
by duckyd (Hermit) on Jan 30, 2006 at 23:56 UTC | |
by GrandFather (Saint) on Jan 31, 2006 at 00:43 UTC | |
|
Re^2: Reg Ex with quotes
by Anonymous Monk on Jan 30, 2006 at 23:59 UTC |