You are here

function bueditor_check_match in BUEditor 6

Same name and namespace in other branches
  1. 5 bueditor.module \bueditor_check_match()
  2. 6.2 bueditor.inc \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.module
Insert textarea id into preset of the editor.

File

./bueditor.module, line 255

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);
}