Last active
August 29, 2015 14:22
-
-
Save keeprock/98ce632c8c9134302bd1 to your computer and use it in GitHub Desktop.
Use Regex to replace text between HTML tags
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
preg_match('/>([^<]*)/i', $bread_item, $text); | |
$bread_item_text = preg_replace("/&#?[a-z0-9]+;/i", "", $text[1]); | |
$bread_item_text = '>' . truncate_utf8($bread_item_text, 50, TRUE, TRUE, 1) . '<'; | |
$bread_item_text = preg_replace('/>[^<]*</i', $bread_item_text, $bread_item); | |
$breadcrumb[$key] = $bread_item_text; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment