Tobias DiPasquale wrote:


> NOTE: What I mean here is that I would like to match the beginning of the
> a href tag as one "token", then put the contents of the tag in another
> token, while putting the </a> closer tag in yet another token.


~

---------8<----------
a = '<a
href="http://foo">
foo
</a>
'
a =~ /(<a.+?href=['"](.+?)['"].*?>)(.+?)(<\/a>)/m

opening = $1
url     = $2
content = $3
closing = $4
[opening,url,content,closing].each do |frag|
  puts frag.gsub /\n/, ' '
end

--------8<----------

=>
-------
<a href="http://foo">
http://foo
  foo
</a>
-------------


HTH,
Tobi

-- 

* peace&love.
* http://www.pinkjuice.com/