In meiner Datenbank habe ich eine Zahl: 00 48 76 848MySQL Regex ignoriert Leerraum
Die Saite gegen anzupassen ist: 004876848
ich habe:
...
WHERE tel REGEXP '\s($q)'
...
Aber das doesn‘ t arbeiten.
Welche Regexp brauche ich, um dies zu erreichen?
$q = preg_replace("/[\\D]+/", "", $q);
return DB::select('SELECT contacts_phones.id, CONCAT(firstName, " ", lastName) AS name, tel, "phoneNumber" AS type, entities.name AS company,
entities.id AS companyId
FROM contacts_phones, contacts, entities
WHERE tel REGEXP "[[:space:]]"
AND contacts_phones.contactId = contacts.id
AND entities.id = contacts.ownerId
AND contacts.ownerTypeId = 1
AND contacts.archived = 0
LIMIT ' . $limit, array('%' . $q . '%'));
brauchen in mysql oder PHP? – devpro
@devpro MySql :) – imperium2335