It is currently May 11th, 2024, 9:36 pm

[Solved] WebParser : RegExp length

Get help with creating, editing & fixing problems with skins
User avatar
Bada
Posts: 32
Joined: June 16th, 2011, 12:37 pm

[Solved] WebParser : RegExp length

Post by Bada »

Hi there !
I have a problem with WebParser plugin : if my RegExp contain things wich are not in the url, it returns nothing.
Ex :

Code: Select all

Url=http://code.google.com/p/rainmeter/downloads/list?can=3&q=&colspec=Filename+Summary+Uploaded+Size+DownloadCount
RegExp=(?siU)<td class="vt id col_0">.*name=Rainmeter-(.*)-.*.exe&amp.*32bit/64bit(.*)version.*revision(.*)\n
returns

Code: Select all

 <td class="vt id col_0">
 <a href="detail?name=Rainmeter-2.2.exe&can=3&q=">
 
 Rainmeter-2.2.exe
 

</a>
 </td>
 
 
 
 
 
 
 
 <td class="vt col_1" width="100%"
 onclick="if (!cancelBubble) _go('detail?name=Rainmeter-2.2.exe&can=3&q=')"
 ><a onclick="cancelBubble=true;" href="detail?name=Rainmeter-2.2.exe&can=3&q=">
 
 32bit/64bit version from svn revision 1116
wich is fine, but

Code: Select all

Url=http://code.google.com/p/rainmeter/downloads/list?can=3&q=&colspec=Filename+Summary+Uploaded+Size+DownloadCount
RegExp=(?siU)<td class="vt id col_0">.*name=Rainmeter-(.*)-.*.exe&amp.*32bit/64bit(.*)version.*revision(.*)\n.*<td class="vt id col_0">.*name=Rainmeter-(.*)-.*.exe&amp.*32bit/64bit(.*)version.*revision(.*)\n
returns nothing.
What you have to know is that there is '<td class="vt id col_0">', only one time for now in the url, so I think that is the why of the problem, but I thought that WebParser shouldn't bug is it doesn't find all we ask to him. . .

P.S. I have to let the whole RegExp because most of the time, there is a second '<td class="vt id col_0">' etc. . .

Please, help me ! :)
Last edited by Bada on January 14th, 2012, 10:29 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22632
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WebParser : RegExp length

Post by jsmorley »

If you search for something that doesn't exist in the source using a regular expression, the entire expression will fail and WebParser will just get a "Matching error" in the log and return nothing. That's not so much because of how WebParser works, but is how regular expressions work.

You could probably use a "look ahead assertion" to solve your problem: http://rainmeter.net/cms/Tips-LookAhead
User avatar
Bada
Posts: 32
Joined: June 16th, 2011, 12:37 pm

Re: WebParser : RegExp length

Post by Bada »

Works perfectly fine !
As always, thanks verymuch jsmorley ! :thumbup: