[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Get part text from html source

Posted on 2008-10-01
7
Medium Priority
?
203 Views
Last Modified: 2012-05-05
the source is

<strong>No:</strong> <ins>59520</ins>(f)<br /> or
<strong>No:</strong> <ins>59520</ins>(m)<br />

how to get "m"   or  "f" and 59520 is not a constant it is always number but not constant


and another one


<strong>@O:>@:</strong> <ins class="female">BeBcHo0o0o__</ins><em>

i need the text betwen "ins"  tag  this text "BeBcHo0o0o__"

0
Comment
Question by:dupetata
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 22613349
for( '<strong>No:</strong> <ins>59520</ins>(f)<br />', '<strong>No:</strong> <ins>59520</ins>(m)<br />' ){
     print m(</ins>\W*(\w)),"\n";
}

for( '<strong>@O:>@:</strong> <ins class="female">BeBcHo0o0o__</ins><em>' ){
    print m(<ins\b[^>]*>(\w+)),"\n";
}
0
 

Author Comment

by:dupetata
ID: 22613454
ozo the number 59520 isnot a constant is always changing
0
 

Author Comment

by:dupetata
ID: 22613469
and BeBcHo0o0o__ too
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 84

Expert Comment

by:ozo
ID: 22613516
that's why the m(</ins>\W*(\w)) and m(<ins\b[^>]*>(\w+) try to match the ins, not the 59520  or BeBcHo0o0o__
if the ins also changes, then I'm not sure how you want to determine which part to get.
0
 

Author Comment

by:dupetata
ID: 22613714
ok u didnt get me i have for loop


for my $ids ($start..$end) {
        my $res=$www->get("http://site.com/u:$ids");
        unless($res->is_success) {
                warn "Could not get id $ids: " . $res->code . "\n";
                next;
        }
i need to do it that way

if($res->content =~ /<strong>No:</strong> <ins>some number</ins>(*)<br />/)

and get the value of *
then in the same loop

($value) = $res->content =~ /<ins class="female">***</ins><em>/

and get the value of ***
0
 
LVL 84

Expert Comment

by:ozo
ID: 22613899
if( $res->content =~ /<strong>No:<\/strong> <ins>\d+\/ins>(.*?)<br \/>/ ){
    print $1;
}
0
 
LVL 84

Accepted Solution

by:
ozo earned 2000 total points
ID: 22613956
if( $res->content =~ /<strong>No:<\/strong> <ins>\d+<\/ins>(.*?)<br \/>/ ){
    print $1;
}

($value) = $res->content =~ /<ins class="female">(.*?)<\/ins><em>/;
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question