Connection::sqlFunctionRegexp

public static Connection::sqlFunctionRegexp($pattern, $subject)

SQLite compatibility implementation for the REGEXP SQL operator.

The REGEXP operator is natively known, but not implemented by default.

See also

http://www.sqlite.org/lang_expr.html#regexp

File

core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php, line 282

Class

Connection
SQLite implementation of \Drupal\Core\Database\Connection.

Namespace

Drupal\Core\Database\Driver\sqlite

Code

public static function sqlFunctionRegexp($pattern, $subject) {
  // preg_quote() cannot be used here, since $pattern may contain reserved
  // regular expression characters already (such as ^, $, etc). Therefore,
  // use a rare character as PCRE delimiter.
  $pattern = '#' . addcslashes($pattern, '#') . '#i';
  return preg_match($pattern, $subject);
}
doc_Drupal
2016-10-29 08:56:02
Comments
Leave a Comment

Please login to continue.