expr.html.en revision 4eea6eaa18317f1122158d21b4437d90e04e56d2
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny This file is generated from xml source: DO NOT EDIT
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<title>Expressions in Apache - Apache HTTP Server</title>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<link href="/images/favicon.ico" rel="shortcut icon" /></head>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<p class="apache">Apache HTTP Server Version 2.3</p>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="./">Version 2.3</a></div><div id="page-content"><div id="preamble"><h1>Expressions in Apache</h1>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<p><span>Available Languages: </span><a href="/en/expr.html" title="English"> en </a></p>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny <p>Historically, there are several syntax variants for expressions used to express
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny a condition in the different modules of the Apache HTTP Server.
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny There is some ongoing effort to only use a single variant, called <em>ap_expr</em>,
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny for all configuration directives.
b58460076fe843c11d736ae244c1ac979a6473a4Simo Sorce This document describes the <em>ap_expr</em> expression parser.
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#grammar">Grammar in BNF notation</a></li>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<li><img alt="" src="/images/down.gif" /> <a href="#vars">Variables</a></li>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<li><img alt="" src="/images/down.gif" /> <a href="#binop">Binary operators</a></li>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<li><img alt="" src="/images/down.gif" /> <a href="#unnop">Unary operators</a></li>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<li><img alt="" src="/images/down.gif" /> <a href="#functions">Functions</a></li>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<h2><a name="grammar" id="grammar">Grammar in BNF notation</a></h2>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zelenyexpr ::= "<strong>true</strong>" | "<strong>false</strong>"
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zelenycomp ::= stringcomp
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny | integercomp
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny | unaryop word
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny | word binaryop word
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny | word "<strong>in</strong>" "<strong>{</strong>" wordlist "<strong>}</strong>"
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zelenystringcomp ::= word "<strong>==</strong>" word | word "<strong>eq</strong>" word
b58460076fe843c11d736ae244c1ac979a6473a4Simo Sorce | word "<strong>!=</strong>" word | word "<strong>ne</strong>" word
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny | word "<strong><</strong>" word | word "<strong>lt</strong>" word
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny | word "<strong><=</strong>" word | word "<strong>le</strong>" word
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny | word "<strong>></strong>" word | word "<strong>gt</strong>" word
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny | word "<strong>>=</strong>" word | word "<strong>ge</strong>" word
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zelenyintegercomp ::= word "<strong>-eq</strong>" word | word "<strong>eq</strong>" word
b58460076fe843c11d736ae244c1ac979a6473a4Simo Sorce | word "<strong>-ne</strong>" word | word "<strong>ne</strong>" word
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny | word "<strong>-lt</strong>" word | word "<strong>lt</strong>" word
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny | word "<strong>-le</strong>" word | word "<strong>le</strong>" word
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny | word "<strong>-gt</strong>" word | word "<strong>gt</strong>" word
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny | word "<strong>-ge</strong>" word | word "<strong>ge</strong>" word
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zelenywordlist ::= word
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny | "<strong>'</strong>" string "<strong>'</strong>"
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny | "<strong>"</strong>" string "<strong>"</strong>"
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zelenystring ::= stringpart
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny | string stringpart
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zelenystringpart ::= cstring
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zelenycstring ::= ...
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zelenydigit ::= [0-9]+
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zelenyvariable ::= "<strong>%{</strong>" varname "<strong>}</strong>"
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny | "<strong>%{</strong>" funcname "<strong>:</strong>" funcargs "<strong>}</strong>"
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zelenyfunction ::= funcname "<strong>(</strong>" word "<strong>)</strong>"
7fe69bb6ec70bce439c6b975a9a0044c98ff502bSimo Sorcelistfunction ::= listfuncname "<strong>(</strong>" word "<strong>)</strong>"
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny</blockquote>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<p>XXX: not all vars are available in all request phases</p>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny <table class="bordered"><tr class="header"><th>Name</th></tr>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<tr class="odd"><td><code>HTTP_FORWARDED</code></td></tr>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<tr class="odd"><td><code>HTTP_PROXY_CONNECTION</code></td></tr>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<tr class="odd"><td><code>HTTP_USER_AGENT</code></td></tr>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny <table class="bordered"><tr class="header"><th>Name</th><th>Description</th></tr>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny<tr class="odd"><td><code>REQUEST_SCHEME</code></td>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny<tr class="odd"><td><code>REQUEST_FILENAME</code></td>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny<tr class="odd"><td><code>REMOTE_IDENT</code></td>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny<tr class="odd"><td><code>SERVER_ADMIN</code></td>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny<tr class="odd"><td><code>SCRIPT_FILENAME</code></td>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny<tr class="odd"><td><code>QUERY_STRING</code></td>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny<tr class="odd"><td><code>DOCUMENT_ROOT</code></td>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny<tr class="odd"><td><code>REQUEST_LOG_ID</code></td>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny <table class="bordered"><tr class="header"><th>Name</th><th>Description</th></tr>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny<h2><a name="binop" id="binop">Binary operators</a></h2>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny <p>With the exception of some built-in comparison operators, binary
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny operators have the form "<code>-[a-zA-Z][a-zA-Z0-9_]+</code>", i.e. a
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny minus and at least two characters. The name is not case sensitive.
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny Modules may register additional binary operators.</p>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny <table class="bordered"><tr class="header"><th>Name</th><th>Alternative</th> <th>Description</th></tr>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny<h2><a name="unnop" id="unnop">Unary operators</a></h2>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny <p>Unary operators have the form "<code>-[a-zA-Z]</code>", i.e. a
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny minus and one character. The name <em>is</em> case sensitive.
c03b28a38b14fdb59f74864ae4dc56affe256508Simo Sorce Modules may register additional unary operators.</p>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny <table class="bordered"><tr class="header"><th>Name</th><th>Description</th></tr>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny<h2><a name="functions" id="functions">Functions</a></h2>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny <p>Normal string-valued functions take one string as argument and return
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny a string. Functions names are not case sensitive.
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny Modules may register additional functions.</p>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny <table class="bordered"><tr class="header"><th>Name</th><th>Description</th></tr>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny <td>Lookup request environment variable</td></tr>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny <td>Lookup operating system environment variable</td></tr>
84c611c1b7c04cc7735ab54d4e5f48284b79e6fbJan Zeleny <td>Lookup request environment variable</td></tr>
b58460076fe843c11d736ae244c1ac979a6473a4Simo Sorce <td>Reqturn first match of <code>note</code>, <code>reqenv</code>,
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny <td>Escape special characters in %hex encoding</td></tr>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny <td>Unescape %hex encoded string, leaving URL-special characters encoded (XXX: describe better)</td></tr>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny <p>In addition to string-valued functions, there are also list-valued functions which
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny take one string as argument and return a wordlist, i.e. a list of strings. The wordlist
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny can be used with the special <code>-in</code> operator.
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny Functions names are not case sensitive.
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny Modules may register additional functions.</p>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny <p>There are no built-in list-valued functions. mod_ssl provides
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<p><span>Available Languages: </span><a href="/en/expr.html" title="English"> en </a></p>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<p class="apache">Copyright 2010 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
e76d78338026fa47dca32eaf7f5c15eabb1b951aJan Zeleny<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div>