Tag Archives: ASP

Praise Be for Regular Expressions

I used a regular expression in VB for the first time ever (I think) today!

The reason is that I cached some generated ASP and realised that when I needed to use it on different pages, the id lookup for certain elements would change. So, no problem (except for the fact that I’m coding in ASP):

<code>Dim regExpObj, file_content, newStr
Set regExptObj = new RegExp
With regExpObj
    .Pattern = "idTag[0-9]" 'Matches the id name that I'm using,
        'regardless of what number the generated code makes it
    .Global = True 'Matches all occurrences, not just the first
End With

newStr = objRegExp.Replace (file_content, "idTag3")

response.write newStr
</code>

Easy.

Assault of the dumbfounded

So here I am back at CCJ and everything is normal. There was a log in the technician book asking for a form to add Internet links to the school’s intranet. So I reinstalled Dreamweaver on the development machine (a loose term – it’s an Intel 500mhz with 64MB RAM).

Anyway, I sat down and completed my work eventually. It turns out and Dreamweaver MX 2004 and Windows 98 don’t like each other that much, so I had to reinstall MX v.6. I cursed writing the thing in ASP and was grateful that I had converted the new version to PHP. That still didn’t make it easier for me. I’ve avoided any ASP scripting this year, and only used VBScript for server-side administration on domains. For some reason, the insert record wizard doesn’t like to make it too easy to modify the action once it’s created. Once I had finished the form and discovered that I had missed a field out (I accidentally removed it), I had to start the page over for simplicity.

And what do I get when I say the work is done?
“So they can add links when they want to? That isn’t what I wanted.”

ARGH!

So I’ve had to jiggle to code. They can still add links, but there’s a stamp in the computer name list of the user, time and date that the link was added. At least then it can be traced.

They’ll have to like to like it or lump it for the time being.