Community Patterns

Community Library Entry

0

Regular Expression
Created·2019-03-11 06:39
Flavor·ECMAScript (JavaScript)

/
(^\/.*)?(\/$|\/(\?.*))
/
gm
Open regex in editor

Description

It extracts 3 groups

  1. before trailing slash
  2. trailing slash
  3. queryString ?name1=value1

Then, combing group 1 and group 3. Group 1 and Group 3 are optional

Submitted by anonymous