davidov0009 has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to match a string within some HTML but seem to be having some trouble doing so. The following is part of the HTML source that I am looking to match:
name="challenge" value="26eca68705b3b0c76a6d0602937ac524"I want to grab the string for value. I am using grouping in my regexp and expect therefore that $1 will return 26eca68...etc, essentially the string in between the quotes for the value parameter. Here is the regexp I am using:
When $1 is printed it does not just print the text in between the quotes but instead prints all the remaining text after the first quote of the value parameter so like this: 26eca68705b3b0c76a6d0602937ac524" /><input type="hidden" id="md5pass" name="md5pass" value="1" /><input type="hidden" id="noerror" name="noerror" value="1" /><label><span>Email:</span><input type="text" class="inputtext" name="....MORE HTML SOURCE...$returned_data =~ s/\n//g; my $c_code = $returned_data; $c_code =~ m/name="challenge" value="(.*)"/; #" print $1 . "\n";
Any ideas as to why $1 seems to be capturing more that it should?
use strict; use CGI;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regexp question
by RMGir (Prior) on Dec 20, 2007 at 16:48 UTC | |
|
Re: Regexp question
by kyle (Abbot) on Dec 20, 2007 at 16:50 UTC | |
|
Re: Regexp question
by toolic (Bishop) on Dec 20, 2007 at 16:54 UTC | |
by davidov0009 (Scribe) on Dec 20, 2007 at 17:35 UTC | |
by toolic (Bishop) on Dec 20, 2007 at 17:42 UTC | |
by FunkyMonk (Bishop) on Dec 21, 2007 at 00:18 UTC |