Mobile app version of vmapp.org
Login or Join
Shanna517

: =~ (equal-sign tilde) and m" ... " in .htaccess directive I saw this bit of code on an old forum post: SSLRequire %{HTTP_HOST} =~ m".secure.powweb.com" And I was just wondering what the

@Shanna517

Posted in: #Apache #Htaccess #Httpd

I saw this bit of code on an old forum post:

SSLRequire %{HTTP_HOST} =~ m".secure.powweb.com"


And I was just wondering what the =~ and m" ... " meant. I've been searching online and in the Apache documentation for any mention of the equal-sign tilde operator, but I've found no mention of it. I know that some directives can take a tilde to use a regular expression, but I've never seen the m" ... " form used before.

What exactly is that m" ... " for? Where else would you see this form?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Shanna517

1 Comments

Sorted by latest first Latest Oldest Best

 

@BetL925

That is used for matching a regex in a string.

See man perlop:


Binary "=~" binds a scalar expression to a pattern match. Certain
operations search or modify the string $_ by default. This operator
makes that kind of operation work on some other string. The right
argument is a search pattern, substitution, or transliteration. The
left argument is what is supposed to be searched, substituted, or
transliterated instead of the default $_.


and


m/PATTERN/msixpogc
/PATTERN/msixpogc
Searches a string for a pattern match, and in scalar context
returns true if it succeeds, false if it fails. If no string
is specified via the "=~" or "!~" operator, the $_ string is
searched. (The string specified with "=~" need not be an
lvalue--it may be the result of an expression evaluation, but
remember the "=~" binds rather tightly.) See also perlre. See
perllocale for discussion of additional considerations that
apply when "use locale" is in effect.
...
If "/" is the delimiter then the initial "m" is optional. With
the "m" you can use any pair of non-alphanumeric, non-
whitespace characters as delimiters.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme