I am looking for a way to detect a credit card within a string using C#. Regex is a possibility. I do not want to detect if a string is a credit card.
For example
string text = "Hi mum, here is my credit card 1234-1234-1223-1234. Don't tell anyone";
bool result = TextContainsCreditCard(text);
if (result)
throw new InvalidOperationException("Don't give people your credit card!");