You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by hu...@apache.org on 2013/04/14 08:47:23 UTC

svn commit: r1467730 - /httpd/httpd/trunk/docs/manual/mod/mod_lua.xml

Author: humbedooh
Date: Sun Apr 14 06:47:22 2013
New Revision: 1467730

URL: http://svn.apache.org/r1467730
Log:
fix regex documentation for mod_lua

Modified:
    httpd/httpd/trunk/docs/manual/mod/mod_lua.xml

Modified: httpd/httpd/trunk/docs/manual/mod/mod_lua.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_lua.xml?rev=1467730&r1=1467729&r2=1467730&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_lua.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_lua.xml Sun Apr 14 06:47:22 2013
@@ -864,12 +864,19 @@ end
 </highlight>
 
 <highlight language="lua">
-r:regex(string, pattern) -- Runs a regular expression match on a string, returning captures if matched:
+r:regex(string, pattern, [flags]) -- Runs a regular expression match on a string, returning captures if matched:
 
-local matches = r:regex("foo bar baz", "foo (\w+) (\S*)")
+local matches = r:regex("foo bar baz", [[foo (\w+) (\S*)]])
 if matches then
     r:puts("The regex matched, and the last word captured ($2) was: " .. matches[2])
 end
+
+-- Example ignoring case sensitivity:
+local matches = r:regex("FOO bar BAz", [[(foo) bar]], 1)
+
+-- Flags can be a bitwise combination of:
+-- 0x01: Ignore case
+-- 0x02: Multiline search
 </highlight>
 
 <highlight language="lua">



Re: svn commit: r1467730 - /httpd/httpd/trunk/docs/manual/mod/mod_lua.xml

Posted by Guenter Knauf <fu...@apache.org>.
Hi Daniel,
On 14.04.2013 08:47, humbedooh@apache.org wrote:
> Author: humbedooh
> Date: Sun Apr 14 06:47:22 2013
> New Revision: 1467730
>
> URL: http://svn.apache.org/r1467730
> Log:
> fix regex documentation for mod_lua
>
> Modified:
>      httpd/httpd/trunk/docs/manual/mod/mod_lua.xml
>
> Modified: httpd/httpd/trunk/docs/manual/mod/mod_lua.xml
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_lua.xml?rev=1467730&r1=1467729&r2=1467730&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/docs/manual/mod/mod_lua.xml (original)
> +++ httpd/httpd/trunk/docs/manual/mod/mod_lua.xml Sun Apr 14 06:47:22 2013
> @@ -864,12 +864,19 @@ end
>   </highlight>
>
>   <highlight language="lua">
> -r:regex(string, pattern) -- Runs a regular expression match on a string, returning captures if matched:
> +r:regex(string, pattern, [flags]) -- Runs a regular expression match on a string, returning captures if matched:
>
> -local matches = r:regex("foo bar baz", "foo (\w+) (\S*)")
> +local matches = r:regex("foo bar baz", [[foo (\w+) (\S*)]])
>   if matches then
>       r:puts("The regex matched, and the last word captured ($2) was: ".. matches[2])
>   end
> +
> +-- Example ignoring case sensitivity:
> +local matches = r:regex("FOO bar BAz", [[(foo) bar]], 1)
> +
> +-- Flags can be a bitwise combination of:
> +-- 0x01: Ignore case
> +-- 0x02: Multiline search
>   </highlight>
>
>   <highlight language="lua">
thanks very much for showing this very cool auto escaping trick!
I wasnt aware of it, and this makes a regex a lot more readable!

Gün.