Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
mysql regexp,用于匹配包含非锚定标记的字段和包含模式的href属性_Mysql_Regex - Fatal编程技术网

mysql regexp,用于匹配包含非锚定标记的字段和包含模式的href属性

mysql regexp,用于匹配包含非锚定标记的字段和包含模式的href属性,mysql,regex,Mysql,Regex,我正在尝试从数据库中查找字段中包含href属性以{clickurl}字符串开头的非锚定标记的所有行。例如: <link foo="bar" href="{clickurl}http://wwww.google.com" ... ]*{clickurl}(.*)[\'” 但这也会返回锚标记包含此模式的行 更新 有了来自zx81的输入,我现在使用这个表达式]*href[[:space:]*=[[:space:]*[\”][^>]*{clickurl}(.*[\”],在正常情况下,只有非锚定

我正在尝试从数据库中查找字段中包含href属性以{clickurl}字符串开头的非锚定标记的所有行。例如:

<link foo="bar" href="{clickurl}http://wwww.google.com" ...
]*{clickurl}(.*)[\'”
但这也会返回锚标记包含此模式的行

更新

有了来自zx81的输入,我现在使用这个表达式
]*href[[:space:]*=[[:space:]*[\”][^>]*{clickurl}(.*[\”]
,在正常情况下,只有非锚定标记匹配,但在如下情况下,当href属性位于PHP标记内的echo语句内的标记上时,它也会得到匹配(不需要)因为它实际上是锚标签上的href-

<?php

$GLOBALS['test'] = '{clickurl}tel://test';

echo '<a href="{clickurl}test">Test</a>';

?>


我仍在寻找此修复程序。

请尝试此正则表达式:

< *[^a][^>]+ *href *= *"{clickurl}
<*[^a][^>]+*href*=*“{clickurl}
你就快到了。看起来你有一个小的打字错误:你有
[!a]
,而不是
[^a]
,意思是“一个字符不是“a”

[^a]
[^>]
几乎相同。我相信您知道这一点,但在这两种情况下,
^
都表示“不”,因此
[^>]
是任何不是
的字符

如果您希望不仅允许空格字符,还允许其他类型的空格,可以使用
[[:space:][]*


感谢Tuga提醒我,
\s
在MySQL中不起作用:它与文本“s”匹配。我在这件事上“发呆了”。)

试试这个正则表达式:

< *[^a][^>]+ *href *= *"{clickurl}
<*[^a][^>]+*href*=*“{clickurl}
你就快到了。看起来你有一个小的打字错误:你有
[!a]
,而不是
[^a]
,意思是“一个字符不是“a”

[^a]
[^>]
几乎相同。我相信您知道这一点,但在这两种情况下,
^
都表示“不”,因此
[^>]
是任何不是
的字符

如果您希望不仅允许空格字符,还允许其他类型的空格,可以使用
[[:space:][]*


感谢Tuga提醒我,
\s
在MySQL中不起作用:它与文本“s”匹配。我在这件事上“发呆了”。)

试试这个正则表达式:

< *[^a][^>]+ *href *= *"{clickurl}
<*[^a][^>]+*href*=*“{clickurl}
你就快到了。看起来你有一个小的打字错误:你有
[!a]
,而不是
[^a]
,意思是“一个字符不是“a”

[^a]
[^>]
几乎相同。我相信您知道这一点,但在这两种情况下,
^
都表示“不”,因此
[^>]
是任何不是
的字符

如果您希望不仅允许空格字符,还允许其他类型的空格,可以使用
[[:space:][]*


感谢Tuga提醒我,
\s
在MySQL中不起作用:它与文本“s”匹配。我在这件事上“发呆了”。)

试试这个正则表达式:

< *[^a][^>]+ *href *= *"{clickurl}
<*[^a][^>]+*href*=*“{clickurl}
你就快到了。看起来你有一个小的打字错误:你有
[!a]
,而不是
[^a]
,意思是“一个字符不是“a”

[^a]
[^>]
几乎相同。我相信您知道这一点,但在这两种情况下,
^
都表示“不”,因此
[^>]
是任何不是
的字符

如果您希望不仅允许空格字符,还允许其他类型的空格,可以使用
[[:space:][]*

感谢Tuga提醒我,
\s
在MySQL中不起作用:它与文本“s”匹配。我在这件事上“发呆了”。)

试试这个:

SELECT bannerid FROM ox_banners WHERE htmltemplate REGEXP ".*<[^a][^>]*href=\"\\{clickurl\\}.*";


Options: Case insensitive; Regex syntax only
Match any single character that is NOT a line break character (line feed) «.*»
   Between zero and unlimited times, as few or as many times as needed to find the longest match in combination with the other quantifiers or alternatives «*»
Match the character “<” literally «<»
Match any single character that is NOT present in the list below and that is NOT a line break character (line feed) «[^a]»
   The literal character “a” (case insensitive) «a»
Match any single character that is NOT present in the list below and that is NOT a line break character (line feed) «[^>]*»
   Between zero and unlimited times, as few or as many times as needed to find the longest match in combination with the other quantifiers or alternatives «*»
   The literal character “>” «>»
Match the character string “href="” literally (case insensitive) «href="»
Match the character “{” literally «\{»
Match the character string “clickurl” literally (case insensitive) «clickurl»
Match the character “}” literally «\}»
Match any single character that is NOT a line break character (line feed) «.*»
   Between zero and unlimited times, as few or as many times as needed to find the longest match in combination with the other quantifiers or alternatives «*»
从htmltemplate REGEXP.*]*href=\“\\{clickurl\\}.*”所在的ox\ U横幅中选择bannerid;
选项:不区分大小写;仅限正则表达式语法
匹配任何不是换行符的单个字符(换行符)«。*»
在零次和无限次之间,根据需要找到与其他量词或替代词组合的最长匹配的次数或次数«*»
匹配字符“«>»
按字面意思匹配字符串“href=”(不区分大小写)«href=“»
按字面上的«\{»匹配字符“{”
按字面意思(不区分大小写)匹配字符串“clickurl”«clickurl»
按字面上的«\}匹配字符“}”
匹配任何不是换行符的单个字符(换行符)«。*»
在零次和无限次之间,根据需要找到与其他量词或替代词组合的最长匹配的次数或次数«*»
试试这个:

SELECT bannerid FROM ox_banners WHERE htmltemplate REGEXP ".*<[^a][^>]*href=\"\\{clickurl\\}.*";


Options: Case insensitive; Regex syntax only
Match any single character that is NOT a line break character (line feed) «.*»
   Between zero and unlimited times, as few or as many times as needed to find the longest match in combination with the other quantifiers or alternatives «*»
Match the character “<” literally «<»
Match any single character that is NOT present in the list below and that is NOT a line break character (line feed) «[^a]»
   The literal character “a” (case insensitive) «a»
Match any single character that is NOT present in the list below and that is NOT a line break character (line feed) «[^>]*»
   Between zero and unlimited times, as few or as many times as needed to find the longest match in combination with the other quantifiers or alternatives «*»
   The literal character “>” «>»
Match the character string “href="” literally (case insensitive) «href="»
Match the character “{” literally «\{»
Match the character string “clickurl” literally (case insensitive) «clickurl»
Match the character “}” literally «\}»
Match any single character that is NOT a line break character (line feed) «.*»
   Between zero and unlimited times, as few or as many times as needed to find the longest match in combination with the other quantifiers or alternatives «*»
从htmltemplate REGEXP.*]*href=\“\\{clickurl\\}.*”所在的ox\ U横幅中选择bannerid;
选项:不区分大小写;仅限正则表达式语法
匹配任何不是换行符的单个字符(换行符)«。*»
在零次和无限次之间,根据需要找到与其他量词或替代词组合的最长匹配的次数或次数«*»
匹配字符“«>»
按字面意思匹配字符串“href=”(不区分大小写)«href=“»
按字面上的«\{»匹配字符“{”
按字面意思(不区分大小写)匹配字符串“clickurl”«clickurl»
按字面上的«\}匹配字符“}”
匹配任何不是换行符的单个字符(换行符)«。*»
在零次和无限次之间,根据需要找到与其他量词或替代词组合的最长匹配的次数或次数«*»
试试这个:

SELECT bannerid FROM ox_banners WHERE htmltemplate REGEXP ".*<[^a][^>]*href=\"\\{clickurl\\}.*";


Options: Case insensitive; Regex syntax only
Match any single character that is NOT a line break character (line feed) «.*»
   Between zero and unlimited times, as few or as many times as needed to find the longest match in combination with the other quantifiers or alternatives «*»
Match the character “<” literally «<»
Match any single character that is NOT present in the list below and that is NOT a line break character (line feed) «[^a]»
   The literal character “a” (case insensitive) «a»
Match any single character that is NOT present in the list below and that is NOT a line break character (line feed) «[^>]*»
   Between zero and unlimited times, as few or as many times as needed to find the longest match in combination with the other quantifiers or alternatives «*»
   The literal character “>” «>»
Match the character string “href="” literally (case insensitive) «href="»
Match the character “{” literally «\{»
Match the character string “clickurl” literally (case insensitive) «clickurl»
Match the character “}” literally «\}»
Match any single character that is NOT a line break character (line feed) «.*»
   Between zero and unlimited times, as few or as many times as needed to find the longest match in combination with the other quantifiers or alternatives «*»
从htmltemplate REGEXP.*]*href=\“\\{clickurl\\}.*”所在的ox\ U横幅中选择bannerid;
选项:不区分大小写;仅限正则表达式语法
匹配任何不是换行符的单个字符(换行符)«。*»