Please try if the following code works for you.
Use Regex to find the word that starts with the @
symbol, then replace it with the variable above, and compare it with the first string.
string barcode = "1234";
string string1 = "SkidBarcode " + barcode + " Scanned.";
string string2 = "SkidBarcode @barcode Scanned.";
string result = Regex.Replace(string2, @"\@\w+\b", match => barcode);
if (string1.Equals(result))
{
Console.WriteLine("they are similar");
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.