正则表达式匹配等于波形符Vs双等号

时间:2014-12-17 17:37:35

标签: regex pattern-matching opensips

有线问题,但我想知道=~==

之间的区别

关注“字符串”我试图找到。

if($ua =~ "friendly-scanner") {
  drop()
}

Vs的

if($ua == "friendly-scanner") {
  drop()
}

1 个答案:

答案 0 :(得分:1)

=~ - Does a regular expression matching
== - Compares two for equality

例如:

if($ua =~ "^friendly") is "$ua begins with friendly"
if($ua == "friendly") is "$ua exact match with friendly"