Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Ucase/replace help
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

fishsticks
New Member

USA
77 Posts

Posted - 11 January 2005 :  18:11:34  Show Profile  Visit fishsticks's Homepage  Send fishsticks an AOL message
I want to be able to filter out certain things from a string, such as javascript. Say I want to filter "onLoad=" from a string. I would do this:

Replace(mystring,"onLoad=","")

But someone could easily do this instead:

OnLoAd=

And they win. How can I replace any combination of capital letters?

http://www.sharredprism.com

My website!

Podge
Support Moderator

Ireland
3775 Posts

Posted - 11 January 2005 :  18:30:01  Show Profile  Send Podge an ICQ Message  Send Podge a Yahoo! Message
I don't think there is an easy way to do it while preserving case.

Copy mystring to mystring2.
Convert all of mystring2 to upper or lowercase and then do the compare.
If it contains onload= (or ONLOAD=) return an error.

If it doesn't contain any javascript, etc. then do what you want with mystring.

Podge.

The Hunger Site - Click to donate free food | My Blog | Snitz 3.4.05 AutoInstall (Beta!)

My Mods: CAPTCHA Mod | GateKeeper Mod
Tutorial: Enable subscriptions on your board

Warning: The post above or below may contain nuts.
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 11 January 2005 :  19:15:05  Show Profile
Replace(LCase(mystring),"onload=","")

will work

The UK MkIVs Forum
Go to Top of Page

-gary
Development Team Member

406 Posts

Posted - 11 January 2005 :  21:49:01  Show Profile
Either use instr to determine the start and end of your search string and use mid to remove it, or use a regex. RegEx is much simpler.

KawiForums.com


Go to Top of Page

fishsticks
New Member

USA
77 Posts

Posted - 12 January 2005 :  00:33:58  Show Profile  Visit fishsticks's Homepage  Send fishsticks an AOL message
quote:
Originally posted by DavidRhodes

Replace(LCase(mystring),"onload=","")

will work



I tried that same thing with UCase and ONLOAD, and that didn't work. Theoretically this would have the same effect...?

quote:
Originally posted by -gary

Either use instr to determine the start and end of your search string and use mid to remove it, or use a regex. RegEx is much simpler.



How do you do such a thing?

Thank you all for your replies.

http://www.sharredprism.com

My website!
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 12 January 2005 :  01:58:56  Show Profile
try

Replace(mystring,"onLoad=","",,1)

http://msdn.microsoft.com/library/en-us/script56/html/vsfctreplace.asp

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.25 seconds. Powered By: Snitz Forums 2000 Version 3.4.07