I have a php query working with no problems. However, prior to exporting to a csv file, I need to use a regular expressions to customize the look of a few variables. I have this working as well.
$form_field_number_UPD = preg_replace('(\W{3}.*)', '\n', $form_field_number);
My problem is that I need to export these customized variables, instead of the raw query results.
Is this possible?
Also,
I have been trying to use a regular expression in mysql 5.7 but have had no luck. Is there a preg_replace equivalent in MySQL 5.7? I haven't found one yet. There seems to be one in MySQL 7 but I cannot upgrade yet.
my php that I would like to find an mysql equivalent for:
$form_field_number_UPD = preg_replace('(\W{3}.*)', '\n', $form_field_number);
I tried below but it does not work.
REPLACE(fd.form_field_number, '(\W{3}.*)', '\n', 1, 5) AS New_Field
Thanks for any assistance, even if it is "look over here..."
Revised::
I have a checkbox group column where the results are:
result 1|~|result 1
result 2|~|result 2
result 3|~|result 3
The regex removes the |~| and everything to the right of it, so the results are:
result 1
result 2
result 3
I can do this in php but need to get these results into a downloadable csv file.