with results_stripped as (
select id, title,
replace(replace(replace(replace(replace(regexp_replace(
(regexp_matches(body, '<pre>(.*?)</pre>', 'g'))[1],
E'<[^>]+>', '', 'gi'
), '"' || chr(59), '"'), '>' || chr(59), '>'), '<' || chr(59), '<'), ''' || chr(59), chr(39)), '&' || chr(59), '&'
) as code
from
blog_entry
where
body ~ '<pre>.*<pre>'
)
select id, title, code, 'https://simonwillison.net/e/' || id as link from results_stripped
where code like '%%' || %(search)s || '%%' order by id desc limit 10
canceling statement due to statement timeout