Created
April 29, 2011 20:05
-
-
Save toritori0318/948937 to your computer and use it in GitHub Desktop.
自信ないけどこんな感じ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # for perl | |
| my @allowd_tags = qw/redpre pre code notextile/; | |
| my $str = '<html><body> <p><pre>fufufu</pre></p> </body></html>'; | |
| $str =~ | |
| s{<(\/?([!\w]+)[^<>\n]*)(>?)} | |
| { | |
| if(grep /^$2$/ , @allowd_tags ){ | |
| "<$1$3"; | |
| }else{ | |
| ($3) ? "<$1>" : "<$1"; | |
| } | |
| }ge; | |
| print $str,"\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment