so let me assume couple of things, you have a plain text with html tags and attributes and you want to treat it as a plain text only, probably coz you're getting this text on the server side.
Other than Regex, if you prefer string manipulation through loops then below is the simple loop(logic), through which you can achieve what you want.
I've assumed you need to do it server side, so I've used C# for this purpose, you can use any language, even javascript for that reason to perform this loop.
string sourceText = "<div id=\"target\" ><div>ABCD<img style=\"max-height: 25px; max-width: 25px;\" class=\"inlinetag\" " +
"src=\"http://my_images/icon.gif\\" +
"title=\"<ir_inline itemname=bild_1 type=0><cbd>\"> EFG</div>" +
"</div>";
string targetText = sourceText;
bool traceOn = false;
for (int i = 0; i < targetText.Length; i++)
{
if (traceOn)
if (targetText[i] == '"')
traceOn = false;
if (traceOn)
{
if (targetText[i] == '<')
{
targetText = targetText.Remove(i, 1).Insert(i, "<");
}
if (targetText[i] == '>')
{
targetText = targetText.Remove(i, 1).Insert(i, ">");
}
}
if (targetText[i] == '"')
{
if (targetText[i - 1] == '=')
traceOn = true;
}
}
}
so basically what I am doing is manipulating the pattern for your replacements i.e.
you need to replace only those < and > which occur inside a double quote and that also preceded by an '='. It works perfectly.
It is not a perfect solution, but then it should give you and Idea, how you can process down your string. somebody here can write even more powerful and flexible logic. try/imporve it out.
Other solution can be, to treat entire string of yours like an xml. i.e.
almost all server side languages provide tools to process a string as an xml. Find the one suiting your need i.e.
I could have done something like
XmlDocument doc = new Xmldocument();
doc.LoadXml(targetString);
and then I could easily retrieve any tag and its attribute.
as for regex, I am soo frightened of them.
It should give you an idea.