Hi all
I've a simple problem I can't solve by myself, I apologize for that.
I want to clean up a mysql database, derived by ms access, with spaces where they shouldn't be, parsing/reading a mysqldump and converting spaces into underscores...
for example:
I would like this converted to:create table `table name`( `field name1` type1 not null default 'x', `field name2` type2 default null, ... primary key (`pk name`), key `key name` (`field name1`, `field name2`) ) engine=other things here;
this means that everything in the format of:create table `table_name`( `field_name1` type1 not null default 'x', `field_name2` type2 default null, ... primary key (`pk_name`), key `key_name` (`field_name1`, `field_name2`) ) engine=other things here;
m/`\w+\s+\w+[\s+\w+]+`/ # backticks
should be transformed into a string with spaces converted to underscores (another option could be the camel case: something like `field name` into: `fieldName`)
I understand there must be a very efficient and compact solution, but I'm losing myself in a sql parsing without success.
Please enlighten my way...
In reply to Regexp in mysqldump by brozzis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |