A simple example which will demonstrate how to use Regex to match numeric value inside square brackets.
Example:
Response.Write(extractOrderid("dflgkj [3423]"));
using System.Text;
string extractOrderid(string msg)
{
string resp = "";
Match morderid = Regex.Match(msg, @"\[(\d+)\]");
if (morderid != null)
{
resp = morderid.Value;
}
return resp;
}
Example:
Response.Write(extractOrderid("dflgkj [3423]"));
using System.Text;
string extractOrderid(string msg)
{
string resp = "";
Match morderid = Regex.Match(msg, @"\[(\d+)\]");
if (morderid != null)
{
resp = morderid.Value;
}
return resp;
}