1. Match a string enclosed by double quotes (without line break)
"[^"\r\n]*(?:""[^"\r\n]*)*"
2. Match a string enclosed by single quotes (without line break)
'[^'\r\n]*(?:''[^'\r\n]*)*'
3. Match a string enclosed by single or double quotes (without line break)
'[^'\r\n]*(?:''[^'\r\n]*)*'|"[^"\r\n]*(?:""[^"\r\n]*)*"
4. Match a string enclosed by double quotes (may with line break)
"[^"]*(?:""[^"]*)*"
5. Match a string enclosed by double quotes (without line break, end quote may not exist)
"[^"\r\n]*(?:""[^"\r\n]*)*"?
Python 正则表达式验证字符串
最新推荐文章于 2023-05-15 19:10:48 发布