Just a little kick to this topic :
Is there any way to use regular expressions in Opus ?
In need a elegant script to remove html tags from a string. The nicest way to do this is with regular expressions, i think.
Thanks!
edit: my current solution is the following, but it think sometimes it will strip to much...
edit2 : changed script. I used break to exit loop, but this exits function too.
Code:
function strip_tags(input)
{
var value = input;
// loop till no more brackets
while (true)
{
// find first < and second
var first = value.indexOf('<', 0)
if( first == -1 ) return value;
var second = value.indexOf('>', first)
if( second == -1 ) return value;
// now strip all between first and second.
var value = value.substring( 0, first) + value.substring( second+1);
}
return value;
}