简体   繁体   English

MySQL(PHPMyAdmin)REGEXP,PHP之间的区别

[英]MySQL (PHPMyAdmin) REGEXP , difference between PHP

I have regexp for finding external links on my website, it works fine in PHP: 我使用regexp在我的网站上找到外部链接,在PHP中工作正常:

((http|https):\\/\\/(?!siteurl.com)[\\w\\.\\/\\-=?#]+)

Now I want to use it in PHPMyAdmin in Search tab to search in whole database. 现在,我想在PHPMyAdmin的“搜索”选项卡中使用它来搜索整个数据库。 It doesn't work. 没用 Are there any differences between PHP and MySQL REGEXP ? PHP和MySQL REGEXP之间有什么区别吗? What should be changed in my regexp to make it work in PHPMyAdmin ? 为了使它在PHPMyAdmin中工作,应在我的正则表达式中进行哪些更改?

WHERE url     REGEXP '^https?://'
  AND url NOT REGEXP '^https?://siteurl.com'

Why check for stuff after // ? 为什么要在//之后检查东西? If you do need to, be aware that MySQL does not handle \\w or \\d , so you need something like [-[:alpha:]./=?#]+ . 如果确实需要,请注意MySQL不处理\\w\\d ,因此您需要类似[-[:alpha:]./=?#]+ \\w , by itself, is [[:alpha:]] ; \\w本身是[[:alpha:]] ; \\d is [[:digit:]] . \\d[[:digit:]] Reference 参考

Use these patterns: 使用以下模式:

\\d : [a-zA-Z0-9_] \\d[a-zA-Z0-9_]

\\w : [0-9] \\w[0-9]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM