Talk:Snapshot API
Jump to navigation
Jump to search
Regex for matching the snapshot API
Eyo! Not sure if anyone would find this useful, but I needed to parse the snapshot api easily, so I wrote a regex, and sharing it here for anyone who may find it useful. Not important enough to go on the wiki page for it, so I put it here as "extra info". It is written in python but should be easy to grab and port over to stuff like perl, ruby, and php. <syntaxhighlight lang="python">
- !/usr/bin/env python3
import re
- Composed from information on wiki.secondlife.com/wiki/Snapshot_API
- Written by Chaser.Zaks / softhyena.com
- Unlicensed/CC0, do what you wish with it. :3 http://unlicense.org/
- Using explicit \n instead of """stuff""" for sanity reasons
rePostcardDetails = re.compile(r"", re.IGNORECASE)
if __name__ == "__main__":
test = rePostcardDetails.match("""""") print("This snapshot was taken by {} at {} ({}, {}, {})!".format( test.group("username"), test.group("sim_name"), test.group("local_x"), test.group("local_y"), test.group("local_z") ))
</syntaxhighlight> --Chaser Zaks (talk) 22:04, 20 March 2017 (PDT)