john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

regular expression link href

A regular expression to find a poorly formed link (but not malformed)...

(php version...)

/<\s*[aA]\s+[hH][rR][eE][fF]\s*=\s*"/

the / symbol is the "start" delimiter

the < symbol
* = 0 or more whitespace characters (\s = space, tab, newline)
either a or A
+ = at least one whitespace character (\s = space, tab, newline)
either h or H
either r or R
either e or E
either f or F
* = 0 or more whitespace characters (\s = space, tab, newline)
= symbol
* = 0 or more whitespace characters (\s = space, tab, newline)
" symbol

the / symbol is the "end" delimiter

  • « spf records
  • phpnotes »

Published

Feb 6, 2010

Category

web

~88 words

Tags

  • expression 3
  • href 1
  • link 4
  • regular 5
  • web 56