C regex for validating url

|~|[\u00A0-\u D7FF\u F900-\u FDCF\u FDF0-\u FFEF])|(%[\da-f])|[!

Assume that this regex will be used for a public URL shortener written in PHP, so URLs like shouldn’t pass (even though they’re technically valid).

or, see this url This should work for most regex processors:/((? Followed by at least one or more valid domain characters (a-z, 0-9, or -)Matches without case sensitivity (/i)It does not enforce white space, so it will match this: blah and return you want to enforce space, add \s to the beginning, but then you have to ensure that you add a space to the beginning of the string to match. They can be replaced with matching groups () if your regex processor has trouble. It's not terribly strict, but it matches all standard domain names (but might let slip through some invalid ones).

Also, next time, you might want to include the programming language or context, because regex processors vary greatly in feature support.

I have applied this in one of my projects and its working there. ([a-z A-Z0-9] (\.[a-z A-Z0-9] ) .*)$ Let me know if you face any problem.

Microsoft is conducting an online survey to understand your opinion of the Msdn Web site.

Leave a Reply