Am struggling in writing the regular expression pattern for the below string. I used the below pattern to get the matched string. But, i got the error.
Note: The input string may be anyone of the below input string.
string input = "IN-7874 - hello";
// or "IN-7874 - Hello"
// "IN-7874 - 1) hello"
// "IN-7874 - 1. hello"
// "IN-7874 - 1)hello"
// "IN-7874 - 1.hello"
string pattern = @"^[A-Z]+\\-^[0-9]\s+\\-\\s+^[A-Z]"; //[any number of capital letters]hyphen[any number of numbers(0-9)]space[hyphen]space[numbers or strings]
var a = Regex.Match(input, pattern);
Could anyone please help me on this?
My output should be in the pattern form of [any number of capital letters]hyphen[any number of numbers(0-9)]space[hyphen]space
Example: {SAM-123 - }// don't consider the curly brace.