I need to extract string from html code. I have a regexp. After I open file (or after I make "get" request) I need to find pattern.
So, I have an html code and I want to find such string:
<input type="hidden" name="qid" ... anything is possible bla="blabla" ... value="8">
I want to find the string qid, then find after it the string value="435345" and extract 435345.
Now I am just trying to find this string (I have already done it) and then I will make a replacement (I am going to do it), but this code couldn't find the pattern. What is wrong?
open(URLS_OUT, $foundResults);
@lines = <URLS_OUT>;
$content = join('', @lines);
$content =~ /<qid\"\s*value=[^>][0-9]+/;
print 'Yes'.$1.'\n';
close(URLS_OUT);
or this code:
my $content = $response->content();
while ($content =~ /<qid\"\s*value=[^>][0-9]+/g)
{
print 'Yes'.$1.'\n';
}
I have checked that the file is not empty and it is opened correctly (I have printed it out), but I the program can't find pattern. What is wrong? I have checked the regular expression using this cite (and some others): http://gskinner.com/RegExr/ It shows that the regular expression is correct and finds what I need.