Hi multidimitsof...,
Refer below sample code.
Namespaces
C#
using System.Text.RegularExpressions;
using System.Web;
VB.Net
Imports System.Text.RegularExpressions
Imports System.Web
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
Uri url = new Uri("https://api.mastergst.com/public/search?email=Multidimitsoftware%40gmail.com&gstin=33AAGCC7144L6ZE");
string gstNo = HttpUtility.ParseQueryString(url.Query)["gstin"];
Regex reg = new Regex("^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$");
if (reg.IsMatch(gstNo))
{
ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Valid GST Number.');", true);
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Invalid GST Number.');", true);
}
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim url As Uri = New Uri("https://api.mastergst.com/public/search?email=Multidimitsoftware%40gmail.com&gstin=33AAGCC7144L6ZE")
Dim gstNo As String = HttpUtility.ParseQueryString(url.Query)("gstin")
Dim reg As Regex = New Regex("^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$")
If reg.IsMatch(gstNo) Then
ClientScript.RegisterStartupScript(Me.GetType(), "alert", "alert('Valid GST Number.');", True)
Else
ClientScript.RegisterStartupScript(Me.GetType(), "alert", "alert('Invalid GST Number.');", True)
End If
End Sub
Screenshot