[SQL] Regulärer Ausdruck im SQL Statement

M3Y3R

Well-known member
ID: 336361
L
8 Mai 2006
1.608
60
Hallo,

wie kann ich im SQL-Statement Reguläre Ausdrücke abfragen bzw. einfügen.


MFG
Papenburger
 
Da musst du in der Dokumentation deines DBMS nachschauen. Da gibt es zum teil massive Unterschiede.
 
Da es sich ja wahrscheinlich um MySql dreht: Pattern Matching

allerdings würde ich davon abraten, da bei solchen Querys kein Index genutzt werden kann (so klug sind die QueryOptimizer noch nicht) und dementsprechend ein Full-Table-Scan durchgeführt wird, der u.U. sehr langsam sein kann.
 
Ich meinte solche Zeichen hier:

Hast du dir das auch mal genau angesehen, was da hinter dem Link verborgen ist?

Some characteristics of extended regular expressions are:

* “.” matches any single character.

* A character class “[...]” matches any character within the brackets. For example, “[abc]” matches “a”, “b”, or “c”. To name a range of characters, use a dash. “[a-z]” matches any letter, whereas “[0-9]” matches any digit.

* “*” matches zero or more instances of the thing preceding it. For example, “x*” matches any number of “x” characters, “[0-9]*” matches any number of digits, and “.*” matches any number of anything.

* A REGEXP pattern match succeeds if the pattern matches anywhere in the value being tested. (This differs from a LIKE pattern match, which succeeds only if the pattern matches the entire value.)

* To anchor a pattern so that it must match the beginning or end of the value being tested, use “^” at the beginning or “$” at the end of the pattern.

Genau um das, was du erfragt hast, geht es dort... :-?
 
Okay, dann hab ich das nicht wirklich verstanden. Mein Englisch ist nicht ganz so gut...