I am trying to set up a little application to search a file and return only the words that have the letters "a b o r t" in alphabetical order. I think I have managed to use .*? to get rid of any characters between these letters but now I am returning words that don't even have all of the letters in them. I know that the fix is likely very short but this is only my second week working in Perl, and I haven't been able to suss it out so far.
Thank you for any help,#!/usr/local/bin/perl -w use strict; # seed files for <> operator @ARGV = qw( /usr/dict/words ); while (<>) { # look for b e n(regardless of intervening characters) print if /a.*?b.*?o.*?r.*?t/; };
In reply to Regular expression questions by chinamox
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |