Regular Expressions 101

Community Patterns

Elite:Dangerous system jump parsing

1

Regular Expression
PCRE (PHP <7.3)

/
{(?<Time>\d{2}:\d{2}:\d{2})\} System:"(?<SystemName>[^"]+)" StarPos:\((?<StarPos_X>[^,]+),(?<StarPos_Y>[^,]+),(?<StarPos_Z>[^)]+)\)ly( Body:(?<Body>\d+) RelPos:\((?<RelPos>[^)]+)\)km)?(\s+(?<TravelMode>\w+))?
/
g

Description

Matches lines which indicate jumping into a new system in the Elite:Dangerous netLog files.

Extracts pertinent data; most important are the Time, System Name, and Star Position. The rest is not interesting (yet) so the regexp could be simplified a little for better performance.

Submitted by anonymous - 8 years ago