-1

Its wired question but i want to know what is the difference between =~ and ==

Following "string" i am trying to find.

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

Vs

if($ua == "friendly-scanner") {
  drop()
}
Satish
  • 16,544
  • 29
  • 93
  • 149

1 Answers1

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

For example:

if($ua =~ "^friendly") is "$ua begins with friendly"
if($ua == "friendly") is "$ua exact match with friendly"
admdrew
  • 3,790
  • 4
  • 27
  • 39
nitishagar
  • 9,038
  • 3
  • 28
  • 40