Ich habe eine Datenbanktabelle wie unten:
Spalte Produktbeschreibung enthält HTML wie unten:
Code: Select all
Utilisations : Eau et air comprimé.
Limites de températures : -5° à +60°C.
PMS : 10 Bars.
Spécifications :
- Matricé à chaud de barre en laiton.
- Entre griffes : 41 mm.
Normalisations :
Construction conforme à la norme NF E29-573.
Directive 2014/68/UE : Produits exclus (Article 1, §2.b).
[*][url=http://www.adgvalve.com/fr/index.php?controller=attachment&id_attachment=304]Télécharger la Fiche technique [/url]
Davon möchte ich nun den gesamten -HTML-Code entfernen, der ein -Tag darunter enthält.
Das Endergebnis nach dem Austausch muss also sein:
Code: Select all
Utilisations : Eau et air comprimé.
Limites de températures : -5° à +60°C.
PMS : 10 Bars.
Spécifications :
- Matricé à chaud de barre en laiton.
- Entre griffes : 41 mm.
Normalisations :
Construction conforme à la norme NF E29-573.
Directive 2014/68/UE : Produits exclus (Article 1, §2.b).
Ich habe die folgenden Lösungen ausprobiert:
zuerst:
Code: Select all
UPDATE
`tbl_products_lang`
SET
product_description = REGEXP_REPLACE(
product_description,
'[*]]*>.*?.*?',
''
)
WHERE
`productlang_product_id` = '22978'
Zweitens:
Code: Select all
UPDATE
`tbl_products_lang`
SET
product_description = REGEXP_REPLACE(
product_description,
'.*?]*>.*?.*?',
''
)
WHERE
`productlang_product_id` = '22978'
Dritter:
Code: Select all
UPDATE tbl_products_lang
SET product_description = REGEXP_REPLACE(
product_description,
']>.?]>.?.*?',
''
)WHERE `productlang_product_id` = '22978'
Aber keines davon hat funktioniert.
Alle oben genannten Abfrageausführungen endeten mit:
0 Zeilen betroffen.< /em>
Die folgende Abfrage zum einfachen Entfernen des Links funktioniert:
Code: Select all
UPDATE
tbl_products_lang
SET
product_description = REGEXP_REPLACE(
product_description,
']*>(.*?)',
''
)
WHERE
`productlang_product_id` = '22978'
Und deshalb habe ich das Gefühl, dass ich mein Ziel nur mit der Abfrage erreichen kann. Nur, dass ich den regulären Ausdruck nicht korrigieren kann.
Bitte helfen Sie mir.
Hinweis: Ich versuche derzeit, einmal eine ID zu finden Es wurde erfolgreich ausgeführt, dann werde ich die gesamte Tabelle aktualisieren.