Malesef elimde c# kodu var php ye çevirebilirseniz de olur.
tring first = txtFirst.Text;
string last = string.Empty;
string linkValue = string.Empty;
bool catchClose = false;
for (int i = 0; i < first.Length; i++)
{
if (catchClose && first[i] == ' ')
{
last += "'>";
catchClose = false;
last += " " + linkValue + "</a> ";
linkValue = string.Empty;
}
else if (first[i] == '#' || first[i] == '@')
{
if (catchClose)
{
last += "'>";
last += " " + linkValue + "</a> ";
linkValue = string.Empty;
}
if (first[i] == '#')
{
last += "<a href='Tag/";
}
if (first[i] == '@')
{
last += "<a href='User/";
}
catchClose = true;
}
else
{
last += first[i];
}
if (catchClose)
{
linkValue += first[i];
}
}
if (catchClose)
{
last += "'> " + linkValue + "</a> ";
}
txtResult.Text = last.Replace(" "," ");