SV: [thelist] Parsing document server side (was Adding title withcss)

Wesley Mason wes at pmason.karoo.co.uk
Thu Jun 24 13:08:20 CDT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I think this should work (yet again, just an example, doubt it'll work  
as I mainly work in PHP, and haven't done much ASP or ASP.NET, or  
JavaScript/EMCAScript, recently):

// <bad code>
Dim regexp;
Set regexp = new RegEx;

result =  
RegEx.replace('<a\s+href\s*=\s*"([^"]*)\.pdf"([^>]*)>(.*?(?=<\/a>))<\/ 
a>', '<a href="\1.pdf" title="PDF Doc">\2</a>');
// </bad code>


Although this seems incredibly wrong and clunky to me, anyone else with  
ASP/.NET/JScript regex experience fancy having a go?

- --
Wesley Aaron Mason
(1st Vamp)
Weblog from nowhere: http://1stvamp.org/
Webcomic from somewhere: http://gfbowl.com/
Public PGP/GPG Key: http://1stvamp.org/stuff/pgp


On Jun 24, 2004, at 4:26 pm, Andreas Wahlin wrote:

> <Yes, parsing the link and adding the title value before sending it to
> the client.
> Probably the best way to do this would be a regular expression, like
> parsing <a href="(.)*.pdf"> and replacing it with <a href="\1.pdf"
> title="PDF Doc"> or the like (*note*, just an example, definitely not
> tested and almost certainly won't work as is).>
>
> I've spent a (short) while googling for information on this. Do you
> actually mean that I can create this mock document
>
> <%@Language="JavaScript"%>
> <%
> Parsing(<a href="(.)*.pdf">, title="pdf-link"); //THIS IS WHERE I DON'T
> GET IT
> %>
> <html>
> <body
> <a href="doc.pdf">document</a>
> </body>
> </html>
>
>
> And that the server will spit out the href as something like
>
> <a href="doc.pdf" title="pdf-link">document</a>
>
> In the end (when all parameters are good). So the server can get what
> would be html content, and change that just as a client side script
> would/could? I want some code please :) Not working code but the
> functions to call if any ... Or maybe I misunderstood the technique?
>
> Andreas
> --
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFA2xiYeOBnpCO+fW8RAkAHAJ9HXsQwzP1wrtjNwOmxghO1zyTytQCfV0hb
cW+ERuZxVcjwp56EqpSwZOQ=
=3yEo
-----END PGP SIGNATURE-----



More information about the thelist mailing list