Regex in javascript for enum datatype of mysql
        Posted  
        
            by 
                himadri
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by himadri
        
        
        
        Published on 2011-01-08T09:37:32Z
        Indexed on 
            2011/01/08
            11:53 UTC
        
        
        Read the original article
        Hit count: 263
        
JavaScript
|regex
Hello, I am working with php and mysql. I have one dropdown box where I am asking datatype of mysql field. Now, I want to put javascript validation for it. I am confused with the enum datatype. I am using regular expression /^[']{1}[^',^\\]+[']{1}$/. This is for one single value of enum values. It is working fine but issue is when I put single quote or backslash with backslash, it is valid but this regular expression shows it as invalid.
For eg, 'a'b' is invalid but 'a\'b' is valid.
© Stack Overflow or respective owner