Regex for valid mysql table field

I'm developing a php application that requires the creation of database fields, based on a source data. This data contains spaces, accents, characteres like slashes etc.

Right now I'm parsing this data, validating spaces, accents, but I would like to do it by a regular expresion that simply returns a valid database field name.

Is this possible ?

Thanks.

Answers


If I was told to do this, I would start reading the rules for defining a column name in MySQL. You can read these rules here : http://dev.mysql.com/doc/refman/5.7/en/identifiers.html.

I have selected MySQL 5.7 but read the documentation for your targetd version.


Need Your Help

Match end and beginning characters or neither

.net regex

I'm trying to make a regex that would match a character at the beginning and end of the expression or match without the character in either place. I know I can do this using a | and two complete

What's the best IDE for DigitalMars D programming?

ide d

Digital Mars D seems to be very good programming language in a lot of ways, but my only problem with it is the amount of time wasted writing arguments to the compiler in the command line at the old