proto-dictionary radius

xlat_purify &User-Name !~ /^foo\nbar$/
match (&User-Name !~ /^foo\nbar$/)

xlat_purify &User-Name !~ /^foo\nbar$/i
match (&User-Name !~ /^foo\nbar$/i)

xlat_purify (&User-Name =~ "handled")
match ERROR offset 16: Expected regular expression

xlat_purify (&User-Name == /foo/)
match ERROR offset 16: Unexpected regular expression

xlat_purify &User-Name =~ &Filter-Id
match ERROR offset 15: Expected regular expression

xlat_expr &User-Name =~ (/foo/)
match ERROR offset 15: Expected regular expression

#
#  Flags
#
xlat_purify &User-Name =~ /bar/i
match (&User-Name =~ /bar/i)

xlat_purify &User-Name =~ /bar/m
match (&User-Name =~ /bar/m)

xlat_purify &User-Name =~ /bar/im
match (&User-Name =~ /bar/im)

xlat_purify &User-Name =~ /bar/ima
match ERROR offset 22: Unsupported regex flag 'a'

xlat_purify &User-Name =~ /bar/ii
match ERROR offset 21: Duplicate regex flag 'i'

xlat_purify &User-Name =~ /bar/iia
match ERROR offset 21: Duplicate regex flag 'i'

#
#  Escape the backslashes correctly
#  And print them correctly
#

xlat_purify &User-Name =~ /@|./
match (&User-Name =~ /@|./)

xlat_purify &User-Name =~ /@|\\/
match (&User-Name =~ /@|\\/)

xlat_purify &User-Name =~ /^([^\\]*)\\(.*)$/
match (&User-Name =~ /^([^\\]*)\\(.*)$/)

xlat_purify &NAS-Port =~ /%{Login-TCP-Port} foo/
match (&NAS-Port =~ /%{Login-TCP-Port} foo/)

#
#  If they're dumb enough to add a cast, then it will be just cast again
#  to "string" before the regular expression is evaluated.
#
xlat_purify (integer)&Filter-Id =~ /foo/
match ((uint32)&Filter-Id =~ /foo/)

xlat_purify &Filter-Id =~ <integer>/foo/
match ERROR offset 15: Expected regular expression

xlat_expr %{33}
match ERROR offset 3: Invalid regex reference.  Must be in range 0-32

xlat_purify &User-Name == /foo/
match ERROR offset 15: Unexpected regular expression

#
#  single-quoted strings in regexes!
#
xlat_purify &User-Name =~ m'foo%'
match (&User-Name =~ m'foo%')

count
match 43
