You are here

function bueditor_check_match in BUEditor 6.2

Same name and namespace in other branches
  1. 5 bueditor.module \bueditor_check_match()
  2. 6 bueditor.module \bueditor_check_match()
  3. 7 bueditor.inc \bueditor_check_match()

Check matching lines of the needle in haystack.(page and textarea id)

1 call to bueditor_check_match()
bueditor_preset_textarea in ./bueditor.inc
Insert textarea id into preset of the editor.

File

./bueditor.inc, line 233
Implements commonly used functions for bueditor.

Code

function bueditor_check_match($needle, $haystack) {
  if ($needle == '') {
    return FALSE;
  }
  $needle = '/^' . preg_replace("/\r\n?|\n/", '|', str_replace(array(
    '*',
    '-',
    '/',
  ), array(
    '.*',
    '\\-',
    '\\/',
  ), trim($needle))) . '$/';
  return preg_match($needle, $haystack);
}