Regex Split on forward slash?

Alan DeKok aland at deployingradius.com
Tue Dec 17 16:05:18 CET 2013


  The issue with the parser is that it's terrible. The "unlang" parser is just the normal config file parser. The backslashes get "eaten" by the confit parser. The unlang code then sees an un-escaped string. So if you want unlang to see an escaped string, you have to escape it twice. 

  Fixing it properly is hard, as all of the existing configurations use the double escapes. So we cant just make single escapes the norm.  It's something we'd have to change in a major release. 

It may be better to allow non-slash characters as regex  delimiters.  That means adding new functionality, which does t break existing configs.   It just means changing the regex parser in src/main/parser.c.  That should be simple. 

Sent from my iPhone

On 2013-12-17, at 7:19 AM, Phil Mayers <p.mayers at imperial.ac.uk> wrote:

> On 17/12/13 11:41, Arran Cudbard-Bell wrote:
> 
>> No, g won't work. You probably need \\/ because of the multiple levels of escaping...
> 
> Really? Isn't the delimiter handled at top-level of the unlang parser?
> 
> I should resurrect my "use any delimiter / more flags / remove double-escaping craziness" regexp patch:
> 
> if (Attr =~ !no\tleaning/toothpicks!giu) {
> ...
> }
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


More information about the Freeradius-Users mailing list