Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Python

r"
^https?:\/\/[A-Za-z0-9:.]*([\/]{1}.*\/?)$
"

Description

extract the path from a URL returns one group (if matching) with the path info e.g. http://somedomain.com/some-page/ http://www.domain.com:8080/some-page/ https://www.google.com:8080/some-page/ all return /some-page/

Submitted by luke_aus - 10 years ago