MySQL regex to return matching string only -
i'm building query run in invision power board hosted site using sql toolbox, unfortunately seems limited , i've not been able add custom sql function far. i've built mutli-table query sake of simplicity simplify here.
the following sample of database , query find profiles include address in me (field_11) profile using regex. results shows entirety of me , not matching string.
is there way structure query return matching string found regex without using bespoke mysql function?
sql database
create table core_pfields_content (`field_11` longtext); insert core_pfields_content (`field_11`) values ('<p> c++ eveloper</p> <p> aj4ndbbljzmrdvtc7jfgavivhuxfdvwqkl </p>'), ('<p> norwegian designer , illustrator working out of oslo. </p>'), ('<p> hello everyone, freelancer photographer </p> <p> portfolio: </p> <p> address: aw7fvzoewafiyyewgxmgog525ncceaxvmg </p>');
query
select field_11 core_pfields_content field_11 regexp '^.*([a][a-km-za-hj-np-z1-9]{26,33}).*';
result
field_11 <p> c++ eveloper</p> <p> aj4ndbbljzmrdvtc7jfgavivhuxfdvwqkl </p> <p> hello everyone, freelancer photographer </p> <p> portfolio: </p> <p> address: aw7fvzoewafiyyewgxmgog525ncceaxvmg </p>
Comments
Post a Comment