RegEx trouble
RegEx trouble
I copy&paste texts into ArticleText field (rich text) from word documents. Due to text is always long, I create for a ArticleText View - ArticlePreview formula field, which should keep first 100 symbols of ArticleText field.
Formula calls function getPreviewText(ArticleText, 100)
Due to value of ArticleText is not a clean text, but html formated text, so I need to clean it from tags by
string getPreviewText(string srcText, int len)
{
str = "<(.|\n)*?>";
input.srcText = (input.srcText).replaceAll(str,"");
it works perfectly excluding
which brings me Normal, 0, X-NONE, etc garbage.
I try to get rid of it by code:
str = "(<!--)(.|\n|\r)*?(-->)";
input.srcText = (input.srcText).replaceAll(str,"");
which I put before tag cleaning code.
But as soon as I add this code into function, my form is freezing after pushing Submit data (Please wait ...)
I think my regex is doing something wrong. Are there any ideas?
Thanks in advance
Andrey