Paste this into a new question or an answer at dba.stackexchange.com:
<!-- --> > select version(); > > <pre> > | version() | > | :-------- | > | 8.0.22 | > </pre> <!-- --> > CREATE TABLE BUCHUNGEN( > BUCHUNGSTEXT varchar(30) > ) > > <pre> > ✓ > </pre> <!-- --> > INSERT INTO BUCHUNGEN(BUCHUNGSTEXT) VALUES('RE12342020 Karl Mustermann'); > INSERT INTO BUCHUNGEN(BUCHUNGSTEXT) VALUES('RE45672020 Grete Beispiel'); > > <pre> > ✓ > > ✓ > </pre> <!-- --> > SELECT > REGEXP_SUBSTR(t.BUCHUNGSTEXT, 'RE[0-9]+') AS BELEGFELD, > BUCHUNGSTEXT > FROM BUCHUNGEN t > > <pre> > BELEGFELD | BUCHUNGSTEXT > :--------- | :------------------------- > RE12342020 | RE12342020 Karl Mustermann > RE45672020 | RE45672020 Grete Beispiel > </pre> *db<>fiddle [here](https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=87cd48fcbb759b5d522f96b88180bb6b)*
back to fiddle