Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * @author Chris Horeweg in response to http://stackoverflow.com/questions/10248031/php-read-content-and-do-a-preg-match
- */
- $content = "@font-face {
- font-family: 'someFonts';
- }
- @font-face {
- font-family: 'someotherFonts';
- }
- .style {
- font-family: 'someFonts';
- }";
- if (!preg_match('#@font-face {([^;]+);#i', $content, $matches)) {
- echo 'Not Found';
- }
- else {
- echo print_r($matches, true);
- }
- /** Output:
- Array
- (
- [0] => @font-face {
- font-family: 'someFonts';
- [1] =>
- font-family: 'someFonts'
- )
- **/
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement