CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
Matching an Expression in HTML View source

 



hydpm
User

Jul 22, 2008, 12:30 PM

Post #1 of 2 (3083 views)
Matching an Expression in HTML View source Can't Post

   

Hi,

In my View source of HTML page, the content i need to match is like below: I am reading the content line by line but i need to match the whole lines below in one single expression.

------------------------------------------------------------------------------------------------------------

<input type="checkbox" name="selectedEntityPKs" value="112" onclick="shiftCheckUpdateByName('allbox', name, value, event)">

</td>

<td>

T5m VVC175_V3.5

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



I am trying to match as below:

/<input type="checkbox" name="selectedEntityPKs" value="(\d+)" onclick="shiftCheckUpdateByName\('allbox', name, value, event\)">/

The above matching till the first line i.e <input type="checkbox" name="selectedEntityPKs" value="112" onclick="shiftCheckUpdateByName('allbox', name, value, event)">

but there are End of lines are there after this line which i am trying to match with \n which is not working.



Can any one help me in matching the whole content in the above till T5m VVC175_V3.5.




KevinR
Veteran


Jul 22, 2008, 12:37 PM

Post #2 of 2 (3082 views)
Re: [wingsof5r] Matching an Expression in HTML View source [In reply to] Can't Post

Read the html code into a scalar and use the 's' option to match the lines you want to find. Untested:


Code
if ($html =~ /<input type="checkbox" name="selectedEntityPKs" value="(\d+)" onclick="shiftCheckUpdateByName\('allbox', name, value, event\)">.*?T5m VVC175_V3\.5)/s) { 
print "Found it";
}


Or wait for a better suggestion.
-------------------------------------------------

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives