What\'s the regular expression to check if a string starts with \"mailto\" or \"ftp\" or \"joe\" or...
Now I am using C# and code like this in a big if with many ors
You could use:
^(mailto|ftp|joe)
But to be honest, StartsWith is perfectly fine to here. You could rewrite it as follows:
string[] prefixes = { "http", "mailto", "joe" };
string s = "joe:bloggs";
bool result = prefixes.Any(prefix => s.StartsWith(prefix));
You could also look at the System.Uri class if you are parsing URIs.