in reply to Re^2: Find a specific word in a text file
in thread Find a specific word in a text file
# find word if ($string =~ /\bword\b/g) { # skip forward from end of word 12 characters (just an example) pos($string) = pos($string)+12; # skip forward over whitespace and grab 5 digits: if ($string =~ /\s*(\d{5})/gc) { print "here are your digits: $1"; # now pos points to after digits } else { # pos is unchanged (due to /c flag); try something else } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Find a specific word in a text file
by algonquin (Sexton) on Sep 11, 2004 at 10:55 UTC |