What's the ereg() equivalent

147 Views Asked by At

What's the PHP ereg() equivalent in Visual Basic .NET?

I'm trying to translate this tripcode encoder from PHP to VB.NET

function tripcode($name)
{
    if(ereg("(#|!)(.*)", $name, $matches))
    {
        $cap  = $matches[2];
        $cap  = strtr($cap,"&", "&");
        $cap  = strtr($cap,",", ",");
        $salt = substr($cap."H.",1,2);
        $salt = ereg_replace("[^\.-z]",".",$salt);
        $salt = strtr($salt,":;<=>?@[\\]^_`","ABCDEFGabcdef"); 
        return "!".substr(crypt($cap,$salt),-10)."";
    }
}
1

There are 1 best solutions below

0
Jeff Reed On BEST ANSWER
        $Str = "#your_tripcode_password"
        Dim Reg As New Regex("(#|!)(.*)")
        If Reg.IsMatch(Str) Then
            Dim Cap$ = Reg.Matches(Str)(0).Groups(2).Value

        End If