This question already has answers here:
Regular expression, How to allow combination of dot (period) and letters?
                            
                                (7个答案)
                            
                    
                去年关闭。
        

    

regexp=^(?:[a-zA-Z]+(?:[.'\-,])?\s?)+$,我应该怎么做才能只允许字母数字和点?谢谢!

最佳答案

尝试这个:

regexp = ^[a-zA-Z0-9\.]+$

08-26 14:29