Regex pattern for checking if a string starts with a certain substring?

Posted by kacalapy on Stack Overflow See other posts from Stack Overflow or by kacalapy
Published on 2010-05-01T16:49:14Z Indexed on 2010/05/01 17:07 UTC
Read the original article Hit count: 279

Filed under:
|
|

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:

String.StartsWith("mailto:")
String.StartsWith("ftp")

It looks like a regex would be better for this. Or is there a C# way I am missing here?

© Stack Overflow or respective owner

Related posts about regex

Related posts about c#