If a connection that comes in with a GROUP NAME from SQL of "USUK-XX" or "WUK-XX" and I want to strip of the "-XX", how would I do this with ulang so I only validate the following?
Using the regexp feature, you can match part of an attribute then reference it later, like so: if (SQL-GROUP =~ /(.*)-XX/) { update request { SQL-GROUP := "%{1}" } }
--Mike
Thx Mike, Sorry, I don't think my example help as XX could be ANYTHING. E.g. USUK-5GB ; USUK-1GB ; USUK-10GB, so looking to STRIP everying after the "-" and including the "-" to the end of the string. The reason for doing this as I only want to validate against the first part of the String, otherwise the Nested IF Statment will be Huge. If your able, would appreciate if you can update the IF statement below to reflect what I'm trying to do. if(SQL-GROUP == "USUK") { ok } elsif(NAS-IP-Address == AAA.BBB.CCC.DDD && SQL-GROUP == "WUK") { ok } else { reject } Thx in advance Nev
The if statement can remain the same, add before it: if (SQL-GROUP =~ /(.*)-.*/) { update request { SQL-GROUP := "%{1}" } } This assumes that: a) There is never a '-' in the USUK or whatever part. b) You don't need to reference the original SQL-GROUP value. If you do, you may want to use something like: if (SQL-GROUP =~ /(.*)-.*/) { update control { Tmp-String-0 := "%{1}" } } if(control:Tmp-String-0 == "USUK") { ok } etc. --Mike
participants (2)
-
Michael Bryant -
Neville