1
2
3
4
#!/usr/bin/php
<?php
/**
...

PHP HTML Filter

by grom, October 23, 2008 23:00, 1 refactoring, tagged with php, html, parser, sanitize

Only allow subset of HTML. ...

A14537020ec5b11fea3b956353724860 Talk
1
2
3
4
private static Regex _namedtags = new Regex
    (@"</?(?<tagname>\w+)[^>]*(\s|$|>)",
    RegexOptions.Singleline | RegexOptions.ExplicitCapture);
...

C# Balance HTML Tags

by Jeff Atwood, July 11, 2008 08:40, 25 refactorings, tagged with html, balance, tags, unbalanced

For the subset of HTML tags...

51d623f33f8b83095db84ff35e15dbe8 Talk
1
2
3
4
private static Regex _tags = new Regex("<[^>]*(>|$)", RegexOptions.Singleline | RegexOptions.ExplicitCapture | RegexOptions.Compiled);
private static Regex _whitelist = new Regex(@"
    ^</?(a|b(lockquote)?|code|em|h(1|2|3)|i|li|ol|p(re)?|s(ub|up|trong|trike)?|ul)>$
...

C# Sanitize HTML

by Jeff Atwood, June 20, 2008 08:24, 54 refactorings, tagged with xss, sanitize, html

Takes a provided HTML strin...

51d623f33f8b83095db84ff35e15dbe8 Talk
1
2
3
4
<?php

function fetch($url,$start,$end){
...

PHP Wikipedia API and text form...

by z3ro, January 09, 2008 18:37, 1 refactoring, tagged with wikipedia, api, wikimedia, php, xml, regex, parser, formatting, plain html, html, convert

I need to add Wikipedia's i...

E90ba01aea329491b312280d1eea606b Talk
1
<%= (@post.category ? @post.category.name : '') + ' ' + link_to(@post.title, post_path(@post)) %>

Ruby Handling nil object

by macournoyer, November 14, 2007 02:07, 13 refactorings, tagged with rails, html

@post.category can be nil, ...

Bfec5f7d1a4aaafc5a2451be8c42d26a Talk
1
curl http://www.cnn.com | perl -ne 'm/>([^<].*?[^>])<\// && print$1."\n"'

Perl Perl one-liner to extract x...

by griflet, November 13, 2007 17:19, 3 refactorings, tagged with perl, oneliner, one-liner, xml, tags, html, xhtml

Hello,
I'm a web-scrapping...

Aae34a7973a8d98e53764a1c89090c55 Talk