Jump to content

StringRegExp pattern


d0n
 Share

Recommended Posts

i am trying to get a pattern

attachment.php?aid=787795&k=ed6f1934ea92a037f4bbd102b7c80db9&t=1259460253&fid=8&sid=37f8lAaodEqWbOSkKY5XoH4xt5BqvMruZfXtDM5Wp%2BekDUE

in this line

<a href="attachment.php?aid=787795&amp;k=ed6f1934ea92a037f4bbd102b7c80db9&amp;t=1259460253&amp;fid=8&amp;sid=37f8lAaodEqWbOSkKY5XoH4xt5BqvMruZfXtDM5Wp%2BekDUE"  onmouseover="showMenu(this.id,false,2)" id="aid787795" target="_blank" title="">Show Ch01.torrent</a> (17.98 KB)

I have this but it doesn't seem to be getting the stuff in the bracket

$Link = StringRegExp($HTML, '.*?<a href="(.*?)".*?Show Ch01.torrent</a>.*?', 1)

Theres a bunch of crap before and after it, but i am not sure what is wrong

Link to comment
Share on other sites

This works for me

$Link = StringRegExp($HTML, "(?i)<a\shref[\s=]+[\x22\x29](.+?)[\x22\x29]", 1)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

can i ask what \x22\x29 is? do they equal " ?

because using this is giving me HTML codes from before this line

\x22 = double quote

\x29 = single quote

If you are getting other lines before that then we will have to see a bit more of the html code to get the right link unless there is something in that link that is specific and never changes.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

<a href="attachment.php?aid=787795&amp;k=ed6f1934ea92a037f4bbd102b7c80db9&amp;t=1259460253&amp;fid=8&amp;sid=37f8lAaodEqWbOSkKY5XoH4xt5BqvMruZfXtDM5Wp%2BekDUE"  onmouseover="showMenu(this.id,false,2)" id="aid787795" target="_blank" title="">Show Ch01.torrent</a>

This doesn't change

<a href="

onmouseover="showMenu(this.id,false,2)"

target="_blank" title="">Show
Link to comment
Share on other sites

<a href="attachment.php?aid=787795&amp;k=ed6f1934ea92a037f4bbd102b7c80db9&amp;t=1259460253&amp;fid=8&amp;sid=37f8lAaodEqWbOSkKY5XoH4xt5BqvMruZfXtDM5Wp%2BekDUE"  onmouseover="showMenu(this.id,false,2)" id="aid787795" target="_blank" title="">Show Ch01.torrent</a>

This doesn't change

<a href="

onmouseover="showMenu(this.id,false,2)"

target="_blank" title="">Show

Those are also most likely common to all the links on the page too so they won't help. Can you provide a link to the page you are trying to read?

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

sorry i think i forgot to mention that there is only 1 'Show Ch01.torrent' in the source of the site

that is why i tried something like this in the beginning but failed :)

$Link = StringRegExp($HTML, '.*?<a href="(.*?)".*?Show Ch01.torrent</a>.*?', 1)
Link to comment
Share on other sites

sorry i think i forgot to mention that there is only 1 'Show Ch01.torrent' in the source of the site

that is why i tried something like this in the beginning but failed :)

$Link = StringRegExp($HTML, '.*?<a href="(.*?)".*?Show Ch01.torrent</a>.*?', 1)

"(?i)<a\shref[\s=]+[\x22\x29](.+?)[\x22\x29].+Show\s*Ch01\.torrent"

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Actually that last one should be

"(?i)<a\shref[\s=]+[\x22\x29]*(.+?)[\x22\x29\s].+Show Ch01.torrent"

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

I just tested this and it works for me

$Link = StringRegExp($HTML, "(?i)<a\shref[\s=]+[\x22\x29]*(.+?)[\x22\x29\s].+Show\s*Ch01.torrent", 1)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...