regular expressions for web designers

 

Overview

these are useful regular expressions/regexes/regexps you can use in daily work.

Downloads

find php functions

find

function\s+[a-zA-Z_][a-zA-Z0-9_*]*\s*\([^)]*\)\s*\{
Download Now
find-php-functions.dwr (dreamweaver)



find javascript functions (php does not allow leading $ so maybe you can use this for both if you are careful)

find

function\s+[$a-zA-Z_][a-zA-Z0-9_*]*\s*\([^)]*\)\s*\{
Download Now
find-javascript-functions.dwr (dreamweaver)



find named entity

find

&[a-zA-Z][a-zA-Z0-9]*;
Download Now
find-named-entity.dwr (dreamweaver)



find numeric entity

find

&#[0-9]+;
Download Now
find-numeric-entity.dwr (dreamweaver)



find numeric or named entity

find

&(#[0-9]+|[a-zA-Z][a-zA-Z0-9]*);
Download Now
find-numeric-or-named-entity.dwr (dreamweaver)



xhtml replace open script tag

find

<[Ss][Cc][Rr][Ii][Pp][Tt](\s+[tT][yY][pP][eE]\s*=\s*['"]text/javascript['"][ \t]*)>

replace with

<script$1><!--//--><![CDATA[//><!--
Download Now
xhtml-replace-open-script.dwr (dreamweaver)



xhtml replace close script tag

find

</[Ss][Cc][Rr][Ii][Pp][Tt]\s*>

replace with


//--><!]]></script>
Download Now
xhtml-replace-close-script.dwr (dreamweaver)



xhtml replace open style tag

find

<[Ss][Tt][Yy][Ll][Ee]\s+[Tt][Yy][Pp][Ee]\s*=\s*"text/css"\s*>

replace with

<style type="text/css"><!--/*--><![CDATA[/*><!--*/
Download Now
xhtml-replace-open-style.dwr (dreamweaver)



xhtml replace close style tag

find

</[Ss][Tt][Yy][Ll][Ee]\s*>

replace with


/*]]>*/--></style>
Download Now
xhtml-replace-close-style.dwr (dreamweaver)



find c++ functions #1

find

(extern[ \t]+"C"[ \t]+)?[a-zA-Z_:][a-zA-Z0-9_+\-*/%\^&|~!=<>,\[\] \t:~]*\([^;]*$
Download Now
find-cpp-functions.dwr (dreamweaver)



find c++ functions #2 (more effective)

find

([a-zA-Z_][a-zA-Z0-9_]*\s)*([a-zA-Z_][a-zA-Z0-9_]*\s*::\s*)*([a-zA-Z_][a-zA-Z0-9_]*|operator\s*(?:\-\-|\-=?|*=?|/=?|%=?|\^=?|&=?|&&|\=?|\|=?|~=?|!=?|=|<?<=?|>?>=?|,|\[\]\(\)|\->\*?|new|delete))\s*{
Download Now
find-cpp-functions2.dwr (dreamweaver)



xml (book page)

see O'Reilly's Mastering Regular Expressions page 484 (last page)


html (book page)

see O'Reilly's Mastering Regular Expressions page 484 (last page)