You are here

function _glossify_regex in Glossify 6.3

Helper function to build regular expression.

4 calls to _glossify_regex()
glossify_nodeapi in ./glossify.module
Implementation of hook_nodeapi().
_glossify_comment_hovertips in ./glossify.module
Helper function to generate hovertips from comment matches.
_glossify_replace in ./glossify.module
Helper function that fetches and returns the styled term depending on the style and term.
_glossify_replace_terms_phpdom in ./glossify.module
Uses PHP's built in DOM extension if available. Adapted from http://stackoverflow.com/questions/3151064/find-and-replace-keywords-by-...

File

./glossify.module, line 1118

Code

function _glossify_regex($configuration, $term_title) {
  $modifiers = _fetch_modifiers($configuration);
  if ($configuration['break'] && $configuration['unicode']) {
    $rx = '/(?<![\\pL\\pN_])(' . preg_quote($term_title, '/') . ')(?![\\pL\\pN_])/' . $modifiers;
  }
  else {
    $rx = '/' . ($configuration['break'] ? '\\b(' . preg_quote($term_title, '/') . ')\\b' : '(' . preg_quote($term_title) . ')') . '/' . $modifiers;
  }
  return $rx;
}