diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index 7250e6ca7eaba82bb5f4ad6134c0ba3e1da2b959..06e7070f7e0290ebbec3ce9cec1db0c99c6a0b28 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -1103,7 +1103,7 @@ std::string LLUrlEntryPlace::getLocation(const std::string &url) const
 //
 LLUrlEntryRegion::LLUrlEntryRegion()
 {
-	mPattern = boost::regex("secondlife:///app/region/[^/\\s]+(/\\d+)?(/\\d+)?(/\\d+)?/?",
+	mPattern = boost::regex("secondlife:///app/region/[A-Za-z0-9]+(/\\d+)?(/\\d+)?(/\\d+)?/?",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_slurl.xml";
 	mTooltip = LLTrans::getString("TooltipSLURL");
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index f007aefc704ee97c79b395a0b3c0e1ae0acc743b..359930b2cd48c4ba9f74b8ad6c2ca154f098df64 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -82,6 +82,8 @@
 #include "llcallstack.h"
 #include "llsettingsdaycycle.h"
 
+#include <boost/regex.hpp>
+
 #ifdef LL_WINDOWS
 	#pragma warning(disable:4355)
 #endif
@@ -143,15 +145,22 @@ class LLRegionHandler : public LLCommandHandler
            
         // build a secondlife://{PLACE} SLurl from this SLapp
         std::string url = "secondlife://";
+		boost::regex name_rx("[A-Za-z0-9]+");
+		boost::regex coord_rx("[0-9]+");
         for (int i = 0; i < num_params; i++)
         {
             if (i > 0)
             {
                 url += "/";
             }
+			if (!boost::regex_match(params[i].asString(), i > 0 ? coord_rx : name_rx))
+			{
+				return false;
+			}
+
             url += params[i].asString();
         }
-           
+
         // Process the SLapp as if it was a secondlife://{PLACE} SLurl
         LLURLDispatcher::dispatch(url, "clicked", web, true);
         return true;