You can use online services like http://regexstorm.net/tester but for your learning.
I recommend a T.D.D. approach with xUnit for example https://xunit.github.io/.
With something like that :
[Theory]
[InlineData("input_1", "pattern")]
[InlineData("input_2", "pattern")]
[InlineData("input_x", "pattern")]
public void ShouldMatch(string input, string pattern)
{
try
{
var isMatch = Regex.IsMatch(input, pattern);
Assert.True(isMatch);
}
catch (ArgumentException)
{
Assert.True(false);
}
}
EDIT :
Thank you for your response, But how can the pattern be ?
- Read the documentation .Net Regular Expression Language - Quick Reference .
- Split your regex by logical OR/AND/NOR/NAND/etc operators .
- Use the Tdd cycle steps .
- Solve the first expression .
- Solve the second expression.
- Solve both expressions with your logical OR/AND/NOR/NAND/etc operators between first and second expression.
- Etc.
After this little exercise.
You will better understand how to build patterns by yourself.