Hệ quản trị CSDL MySQL - Hàm regexp_substr()

Hàm regexp_substr() trong MySQL

Hàm regexp_substr () trong MySQL được sử dụng đểso khớp mẫu. Nó trả về chuỗi con từ chuỗi đã cho.

Cú pháp

select regexp_substr('str', 'match_type', occurrence, position, );  

Ví dụ 1

select regexp_substr('str', 'match_type', occurrence, position, );  

Kết quả:
MySQL regexp_substr Function

Ví dụ 2

select regexp_substr('my sql function', '[a-z]+', 1, 3);  

Kết quả:

MySQL regexp_substr Function