Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Created·2017-05-26 13:48
Flavor·PCRE (Legacy)

/
href=['"]([^'"]*)\.(cf|ht)ml?(\?{1}([^'"]*))?['"]
/
g
Open regex in editor

Description

If you have the source code for any page and want to get all HREF attributes and values, including URL params, that end in .cfm, .cfml, .htm, or .html. Can be easily modified for whatever document type you want (.asp, .aspx, .jsp, etc.)

I needed to do this for a project. It took me a long time to fiddle it into working shape, so I thought I'd share it for anyone else that might need it.

Submitted by anonymous