G
G Klinedinst
This is a really stupid regexp question but can someone please explain
to me why this doesn't work:
if( m/\/{1}/ ) { print $_; }
I want to match only those lines which contain 1 and only 1 "/"
character. My understanding is that a forward slash needs escaped or
else it would signal the end of the regexp, the {1} indicates to match
one and only one time. I have seen examples such as:
$string =~ m/^\S{1,8}\.\S{0,3}/;
which clearly show the syntax of both escaping and repetition and I
can't see for the life of me how mine is different, except that I
don't care about the pattern matching at the beginning of the string.
Output is returning lines that have 1 or more "/" chars. TIA for any
help. BTW, please do not reply with suggestions to use grep, or
sed/awk, or python, or C, or Lisp, or Smalltalk or any other languages
or techniques. I want to use Perl for what I am doing.
G. Klinedinst
to me why this doesn't work:
if( m/\/{1}/ ) { print $_; }
I want to match only those lines which contain 1 and only 1 "/"
character. My understanding is that a forward slash needs escaped or
else it would signal the end of the regexp, the {1} indicates to match
one and only one time. I have seen examples such as:
$string =~ m/^\S{1,8}\.\S{0,3}/;
which clearly show the syntax of both escaping and repetition and I
can't see for the life of me how mine is different, except that I
don't care about the pattern matching at the beginning of the string.
Output is returning lines that have 1 or more "/" chars. TIA for any
help. BTW, please do not reply with suggestions to use grep, or
sed/awk, or python, or C, or Lisp, or Smalltalk or any other languages
or techniques. I want to use Perl for what I am doing.
G. Klinedinst