Skip to content

Instantly share code, notes, and snippets.

@Uradamus
Last active August 29, 2015 14:13
Show Gist options
  • Save Uradamus/379a3c58f66c58ca79dd to your computer and use it in GitHub Desktop.
Save Uradamus/379a3c58f66c58ca79dd to your computer and use it in GitHub Desktop.
Regular Expression for parsing InWorldz and Second Life teleport links.
((?:(?:inworldz|iz|secondlife)://)|(?:hop://[\w_!',@%\$\-\.\+\*\(\)]+(?:\.(?:com|net|org))(?::\d{1,5})?))/?(?:inworldz/)?(?:app/(?:teleport/)?)?(?:(?:(agent|group|parcel)/(?:((?i)[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})/about))|(?:([\w\-_%]+)/))(\-?\d{1,3})?/?(\-?\d{1,3})?/?(\-?\d{1,3})?
[Tests that should fail]
inworldz://InWorldz%20Desert%20Island
hop://InWorldz%20Desert%20Island/123/45/67
[Tests that should pass]
iz://InWorldz%20Desert%20Island/123/45/67
hop://inworldz.com:8002/InWorldz%20Desert%20Island/156/149/33
secondlife://InWorldz%20Desert%20Island/123/45/67
inworldz://InWorldz%20Desert%20Island/123/45/67
inworldz://InWorldz%20Desert%20Island/ [Should default to 128,128,0]
inworldz://InWorldz%20Desert%20Island/-10/-10 [Should default to 0,0,0]
inworldz://InWorldz%20Desert%20Island/10 [Should default to 10,128,0]
inworldz:///inworldz/InWorldz%20Desert%20Island/123/45/67
inworldz:///app/teleport/InWorldz%20Desert%20Island/123/45/67
inworldz:///app/agent/15e426fd-3260-4A18-aff0-231673b1a8f3/about
inworldz:///app/group/40f0eaef-4DDb-40e0-9860-b42717ed92d5/about
inworldz:///app/parcel/00E80300-00E8-0300-9100-0000DF000000/about
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment