Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Could anyone explain me this expression ... 1

Status
Not open for further replies.

xor2

Programmer
Mar 24, 2005
22
$res->{content}=~ s/^.*?<div style="display:none" language="JavaScript1.2">(var.*?)<\/script><\/div>.*$/$1/sg;
my ($code) = $res->{content} =~ /dk42\( unescape\( '([^']+)/;
return dk($code);
 
Can you be more specific. What part of that code don't you understand?

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Well, If I can be honest with You, I don't get it at all ...

So please tell me, which fragment is beeing looked for, replaced for?

What is happening with the content, etc...

Or How could I test this code on win platform to see how
it behaves ...

Really thanks for help.
 
$res->{content} is a reference to a hash

the code replaces the html/javascript stuff with (var.*?) where .*? is whatever comes after "var" and before "</script>". So it looks like it's removing javascript from the string, at least javascript in the hidden div and leaving the var text.

$code is being assigned the value of whatever this matches in the parenthesis: ([^']+)

dk42\( unescape\( '([^']+)

whatever comes after "dk42( unescape'" and beforethe next single quote ', could be something like:

dk42( unescape( 'this get assigned to $code')

then $code is returned with whatever value the function dk() returns. There is no way to test the code unless you have the dk() function also.





------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top