[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gnu-radius] rewrite and regex?
From: |
Sergey Poznyakoff |
Subject: |
Re: [Help-gnu-radius] rewrite and regex? |
Date: |
Wed, 30 Jan 2002 12:31:23 +0200 |
> I'd like to use regex in a rewrite function. In this regex there has to be an
> OR. I tried the following:
>
> if ((s = substr(%[User-Name], x, y)) =~ "^xx$|^xy$") {and so on}
By default, rewrite parser supports only basic regular expressions.
To make it understand extended regexps, apply the following patch
to rewrite.y:
--- rewrite.orig Wed Jan 30 12:28:45 2002
+++ rewrite.y Wed Jan 30 12:22:56 2002
@@ -3578,7 +3578,7 @@ compile_regexp(str)
regex_t regex;
int nmatch;
- int rc = regcomp(®ex, str, 0);
+ int rc = regcomp(®ex, str, REG_EXTENDED);
if (rc) {
char errbuf[512];
regerror(rc, ®ex, errbuf, sizeof(errbuf));
Regards,
Sergey