I have been looking for the answer to this for about 2 days and its becoming a nightmare. I need to let people enter an embed code from a specific website - Soundcloud. These look like this
Code:
<object height="81" width="100%"> <param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Ffull-melt%2Fstrawberry-flava-mixtape&secret_url=false"></param> <param name="allowscriptaccess" value="always"></param> <embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Ffull-melt%2Fstrawberry-flava-mixtape&secret_url=false" type="application/x-shockwave-flash" width="100%"></embed> </object>
All I want to do is validate them so that when I let it go into a database I know that it is not going to cause any damage and is in fact an embed code
I have this so far:
Code:
/<object height="([0-9]*)" width="[0-9]*%)"> <param name="movie" value="(.*)"></param> <param name="allowscriptaccess" value="always"></param> <embed allowscriptaccess="always" height="[0-9]*" src="(.*)" type="application/x-shockwave-flash" width="[0-9]*%)"></embed> </object>/
But it is not validating.
First things I immediately think are problems are:
width="[0-9]*%)" I do not believe will match width="100%"
type="application/x-shockwave-flash" will not match type="application/x-shockwave-flash"
and also,
value="(.*)" will not match value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Ffull-melt%2Fstrawberry-flava-mixtape&secret_url=false" (similiarly with src="(.*)")
But I just can;t figure out how they should be altered. Regex seems to be an ocean of nonsensical characters and rules and google throws up the most pointless anwers.
If anyone could help me out here I would be eternally grateful.
I have been looking for the answer to this for about 2 days and its becoming a nightmare. I need to let people enter an embed code from a specific website - Soundcloud. These look like this
Code:
<object height="81" width="100%"> <param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Ffull-melt%2Fstrawberry-flava-mixtape&secret_url=false"></param> <param name="allowscriptaccess" value="always"></param> <embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Ffull-melt%2Fstrawberry-flava-mixtape&secret_url=false" type="application/x-shockwave-flash" width="100%"></embed> </object>
All I want to do is validate them so that when I let it go into a database I know that it is not going to cause any damage and is in fact an embed code
I have this so far:
Code:
/<object height="([0-9]*)" width="[0-9]*%)"> <param name="movie" value="(.*)"></param> <param name="allowscriptaccess" value="always"></param> <embed allowscriptaccess="always" height="[0-9]*" src="(.*)" type="application/x-shockwave-flash" width="[0-9]*%)"></embed> </object>/
But it is not validating.
First things I immediately think are problems are:
width="[0-9]*%)" I do not believe will match width="100%"
type="application/x-shockwave-flash" will not match type="application/x-shockwave-flash"
and also,
value="(.*)" will not match value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Ffull-melt%2Fstrawberry-flava-mixtape&secret_url=false" (similiarly with src="(.*)")
But I just can;t figure out how they should be altered. Regex seems to be an ocean of nonsensical characters and rules and google throws up the most pointless anwers.
If anyone could help me out here I would be eternally grateful.
|
|
Search Webmaster Help and Solution
Regex help please!Related ItemsQuery failed: connection to localhost:3354 failed (errno=111, msg=Connection refused). |
