Hi,
I have an HTML string with lots of tags (something like this:)
<A> text1 </A> <B> text2 </B> <C> text3 more text3 </C> <D> text4 </D> [/code:1hzlz4g7] and I want to delete some of them. I think this could be done with RegexReplace but I don't know how. What should my RegexReplace expression be if I want to delete (for example) everything from <C> to </C>?
Bump
I think I found a solution:
RegexReplace( String , "<C>[\s\S]*?<\/C>" , "g" , "")[/code:2jwaee1u] But I don't understand why this doesn't work in Construct 2, it works perfectly in [url=http://www.regexpal.com/]http://www.regexpal.com/[/url]. Even RegexMatchCount returns 0, is it maybe a C2 bug?
Might want to look for a javascript solution.
That's not just plain ole text, its formatted html on different lines.
newt
I tried with this:
[quote:31r82g5e]Browser --> Execute Javascript:
"var str = '"&varWithMyString&"'; str= str.replace(/<C>[\s\S]*?<\/C>/, ''); c2_callFunction('myFunction',[str]);"[/code:31r82g5e] Function --> On "myFunction" --> Set text to Function.Param(0) This should work but... it doesn't <img src="{SMILIES_PATH}/icon_neutral.gif" alt=":|" title="Neutral"> That's not just plain ole text, its formatted html on different lines. It doesn't matter, it doesn't work with plain text either. I've already tried. Anyway, if it works at [url=http://www.regexpal.com/]http://www.regexpal.com/[/url], it should also work in C2...
Develop games in your browser. Powerful, performant & highly capable.
Using a sample from here:
I hacked in your values, and it seems to work fine.
http://www.blackhornettechnologies.com/Construct2Stuff/ChesVCF_RegexTester.capx