I would probably go with this answer from the SO you posted: http://stackoverflow.com/a/295152/200945 - it is most restrictive, but I consider this a good thing in this regard.
I would probably go with this answer from the SO you posted: http:// stackoverflow. com/a/295152/ 200945 - it is most restrictive, but I consider this a good thing in this regard.