You are here

function _collapse_text_find_tags in Collapse Text 7.2

Same name and namespace in other branches
  1. 6.2 collapse_text.module \_collapse_text_find_tags()

find all of the [collapse...] tags and return an array of their locations

1 call to _collapse_text_find_tags()
_collapse_text_filter_process in ./collapse_text.module
Implements hook_filter_FILTER_process().

File

./collapse_text.module, line 285
collapse_text is an input filter that allows text to be collapsible

Code

function _collapse_text_find_tags($text, $options) {
  $matches = array();
  $regex = '/
    (?<!\\\\)     # not proceeded by a backslash
    \\[            # opening bracket
    \\/?           # a closing tag?
    collapse      # the word collapse
    [^\\]]*        # everything until the closing bracket
    \\]            # a closing bracket
  /smx';
  preg_match_all($regex, $text, $matches, PREG_OFFSET_CAPTURE);
  return $matches[0];
}