Regular Expressions 101

Community Patterns

Twitter Lat/Lon Coordinate Extraction

0

Regular Expression
PCRE (PHP <7.3)

/
"geo":\{"type":"Point","coordinates":\[(?P<latitude>[^,\]\}]+),(?P<longitude>[\d\.\-]+)
/

Description

This extracts latitude and longitude from a Tweet pulled through the public API.

Submitted by Ed Fullman - 7 years ago