2011-03-24, 09:00 PM
2011-03-24, 09:19 PM
Regular expression:
Replacement:
\[disclosetv\]([0-9]+?)\[/disclosetv\]
Replacement:
<object id="dtvplayer" width="480" height="360"> <param name="movie" value="http://www.disclose.tv/swf/player.swf" /> <param name="wmode" value="transparent" /> <param name="allowFullScreen" value="true" /> <param name="allowscriptaccess" value="always" /> <param name="flashvars" value="config=http://www.disclose.tv/videos/config/flv/$1.js" /> <embed type="application/x-shockwave-flash" width="480" height="360" allowFullScreen="true" src="http://www.disclose.tv/swf/player.swf" flashvars="config=http://www.disclose.tv/videos/config/flv/$1.js"/></embed></object>
2011-03-24, 09:24 PM
(2011-03-24, 09:19 PM)Aries-Belgium Wrote: [ -> ]Regular expression:
\[disclosetv\](.*?)\[/disclosetv\]
I'll suggest to use ([A-Za-z0-9]+) instead of (.*?)
2011-03-24, 11:14 PM
(2011-03-24, 09:24 PM)Yaldaram Wrote: [ -> ](2011-03-24, 09:19 PM)Aries-Belgium Wrote: [ -> ]Regular expression:
\[disclosetv\](.*?)\[/disclosetv\]
I'll suggest to use ([A-Za-z0-9]+) instead of (.*?)
Calculating ranges in regular expression takes longer than just taking any character. But if you want to add some extra check to see if the id is valid, only [0-9]+? would be sufficient as the id only has numbers in it.
2011-03-25, 10:34 PM
Isn't "(.*?)" insecure in some form? I remember being told that. (No clue why.)
2011-03-25, 10:51 PM
It can be in certain cases, like in the [url] it doesn't use (.*?) as then you would be able to do something like [url]" name="test[/url] to set the name variable to test, which could be replaced with a pid or something else to screw it up. So if it's inside quotations it is better to specify.