Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
((<div[\s]+?id=\"fb-root\"[\s\S]+?<\/div>)*[\s]*(<script[\s\S]+?\/script>)*[\s]*(<div[\s]+?class=\"fb-post\"[\s\S]+?(<div[\s]+?class=\"fb-xfbml-parse-ignore\"[\s\S]+?<\/div>)*<\/div>)*)
/

Description

This pattern matches to the facebook post embed codes. It matches on each parts of the whole embed code individualy, and matches on the complete embed code either.

Submitted by kristian tanacs - 10 years ago