Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: to get next line of pattern matched

by 2teez (Priest)
on Jan 07, 2013 at 09:25 UTC ( #1011988=note: print w/ replies, xml ) Need Help??


in reply to to get next line of pattern matched

In a much as I will not recommend using regex to parse HTML doc., however, for this you could use Look-Around Assertions like so:

use warnings; use strict; my $str = "<div class='PlayVideo'></div> A8A <div class='RadioButtonClipStyle'>"; if ( $str =~ m#(?<=</div>)(.+?)(?=<div.+?>)#s ) { print $1; ## prints A8A }

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me


Comment on Re: to get next line of pattern matched
Download Code
Replies are listed 'Best First'.
Re^2: to get next line of pattern matched
by ansh batra (Friar) on Jan 07, 2013 at 11:00 UTC

    your solution is correct but the file i am parsing contains many div tag
    can you please provide the more specific solution

      Since you're having so many problems achieving this with a regex, have you considered taking the previous advice of using a HTML Parser?

        ill surely consider that advice but i am about to complete something and at this point i am trying not to add any module to this if this is achivable using regular expressions

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011988]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2015-07-29 08:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (261 votes), past polls