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

Re^4: fix the problem of the web crawler

by ati (Initiate)
on Nov 09, 2012 at 14:55 UTC ( [id://1003151]=note: print w/replies, xml ) Need Help??


in reply to Re^3: fix the problem of the web crawler
in thread fix the problem of the web crawler

thanks to you, I almost found the error of the regex but because there are different styles on the text authors there are crawled just the authors who match the firs style, they with the different one does not. I need to make any union of two regex expresions to take both of them.

<td\sclass="coauthor"\sstyle="text-align:right;background:[^"]+"><a\sh +ref="([^"]+)">([^>]+)<\/a>

here to put any union or "and" expression

<td\sclass="coauthor"\sstyle="text-align:right;"><a\shref="([^"]+)">([^>]+)<\/a>

I mean between of this two parts it is needed any union expresion(I don't know what to put), because with "or" | it takes still just the first and authors with the second style does not match.. Am I right, or not? Any suggestion?

Replies are listed 'Best First'.
Re^5: fix the problem of the web crawler
by frozenwithjoy (Priest) on Nov 09, 2012 at 15:29 UTC
    In order to grab things matching both of these formats (and to catch any future style variations), you can sort of just ignore the style information. So, you know that you definitely want to match <td\sclass="coauthor"as well as ><a\shref="([^"]+)">([^>]+)<\/a>, but you almost don't care about what is in between, right?

    The reason I say "almost don't care" is because you want to match everything EXCEPT a closing '>' to make sure your regex doesn't match too much. [^>]* matches 0 or more characters that are not the character '>'.

      I solved it, thousand thanks to you. now it works as before. but there is another problem, if you can suggest me what I can do. the authors with names of more than 3 parts are not crawled, and authors containing ( ' , .Jr, II, III). example this authors:

      Norie De La Cruz Norm O'Neill Norman L. Guinasso Jr. Norris Milton II Northrup Fowler III Noor Asna Fazli Abdul Samad N. S. S. S. N. Usha Devi Niels H. M. Aan de Brugh

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-23 07:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found