n0s3c

regex code

Jun 3rd, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.74 KB | None | 0 0
  1.     Public Shared Function regexs(ByVal pattern As String, ByVal data As String, ByVal replace As String)
  2.         Dim Rgx As New Regex(pattern)
  3.         Dim MatchR As Match = Rgx.Match(data)
  4.         Dim res As String = ""
  5.         While MatchR.Success
  6.             Dim m As String = MatchR.ToString
  7.             If replace <> "" Then
  8.                 m = m.Replace(replace, "")
  9.             End If
  10.             If res = "" Then
  11.                 res = m
  12.             Else
  13.                 res = res & m
  14.             End If
  15.             MatchR = MatchR.NextMatch()
  16.         End While
  17.         Return res
  18.     End Function
  19. ' الاستخدام :
  20. ' regexs("كود الريجكس", Data , "اذا تبغا تسوي ريبليس .. حط الكلام هنا")
Advertisement
Add Comment
Please, Sign In to add comment