For Each nm As String In post.ReplyToList
If Not ids.Contains("@" + nm + " ") AndAlso _
Not nm.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase) Then
- ids += "@" + nm + " "
+ Dim m As Match = Regex.Match(post.Data, "[@@](?<id>" + nm + ")([^a-zA-Z0-9]|$)", RegexOptions.IgnoreCase)
+ If m.Success Then
+ ids += "@" + m.Result("${id}") + " "
+ Else
+ ids += "@" + nm + " "
+ End If
End If
Next
End If
For Each nm As String In post.ReplyToList
If Not ids.Contains("@" + nm + " ") AndAlso _
Not nm.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase) Then
- ids += "@" + nm + " "
+ Dim m As Match = Regex.Match(post.Data, "[@@](?<id>" + nm + ")([^a-zA-Z0-9]|$)", RegexOptions.IgnoreCase)
+ If m.Success Then
+ ids += "@" + m.Result("${id}") + " "
+ Else
+ ids += "@" + nm + " "
+ End If
End If
Next
If Not String.IsNullOrEmpty(post.RetweetedBy) Then
Dim m As Match = Regex.Match(retStr, "(^|[^a-zA-Z0-9_])[@@]([a-zA-Z0-9_]{1,20})")
While m.Success
- AtList.Add(m.Result("$2").ToLower)
+ If Not AtList.Contains(m.Result("$2").ToLower) Then AtList.Add(m.Result("$2").ToLower)
m = m.NextMatch
-
End While
'@先をリンクに置換
retStr = Regex.Replace(retStr, "(^|[^a-zA-Z0-9_/])([@@])([a-zA-Z0-9_]{1,20})", "$1$2<a href=""/$3"">$3</a>")