Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PasteAndGo
#1
i have a global shortcut 'win r' to run selected text anywhere.
what would be the best way to check if selection is an url ?

maybe i don't have to perform some regex when web or
something similar also checks if a string is valid as url.

--
i found this:

Quote:Regex theRegexURL = new Regex("(([a-zA-Z][0-9a-zA-Z+\\-\\.]*Smile?/{0,2}[0-9a-zA-Z;/?Angry&=+$\\.\\-_!~*'()%]+)?(#[0-9a-zA-Z;/?Angry&=+$\\.\\-_!~*'()%]+)?");

If (theRegexURL.IsMatch(theUrlInput))

{

//url matches

}

else

{

//url does not match

}
pi
#2
Try PathIsURL or some other function from shlwapi.dll.


Forum Jump:


Users browsing this thread: 1 Guest(s)