Regular Expressions 101

Community Patterns

LeafletJS filename matcher

1

Regular Expression
PCRE (PHP <7.3)

/
[\/^](leaflet|mapbox)[\-\._]?([\w\-\._]*)\.js\??
/
g

Description

Regex used to identify location, i.e. URL of the <script> tag that loaded Leaflet (or Mapbox).

Submitted by cebence - 10 years ago