Link to home
Start Free TrialLog in
Avatar of Dutch_guy
Dutch_guy

asked on

ASP, vbscript - regex replace

I want to replace some text in the following code that users can insert in a CMS system:

<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/W8_Kfjo3VjU&hl=nl_NL&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/W8_Kfjo3VjU&hl=nl_NL&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>

As you can see this is from Youtube to embed a video.

I want to replace these strings in the code:

width="480"
height="385"

These strings can be variable. For instance someone can just insert: width="2480"

I want to avoid people from doing that.

Those 2 stings need to be replaced by:

width="320"
height="200"

Can anyone give some code to do that ?

Also any idea's how to do a basic validation that the code people insert is indeed to embed a Youtube video ?
ASKER CERTIFIED SOLUTION
Avatar of jostrander
jostrander
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dutch_guy
Dutch_guy

ASKER

Works great! Thanks alot !