cancel
Showing results for 
Search instead for 
Did you mean: 

TrafficScript Regular Expression error

SOLVED
Highlighted
New Contributor

TrafficScript Regular Expression error

Hi,

I have the following TrafficScript rule:

if( string.regexmatch(http.getheader("User-Agent"), "crawl | bot | spider | Slurp"))

        {

        rate.use( "Limited", request.getRemoteIP());

        }

It is continually logging the following error in the logs:

Line 1: Regular expression "crawl | bot | spider | Slurp", subject length 0: Aborted, because it returned error code: -2

Anyone have any idea what this means and how I can correct this?

Thanks,

Scott

4 REPLIES
Occasional Contributor

Re: TrafficScript Regular Expression error

What version of Stingray Traffic Manager are you running?

New Contributor

Re: TrafficScript Regular Expression error

It's Stingray Traffic Manager Virtual Appliance 2000L 9.4. The rule syntax compiles successfully and saves without any errors. Thanks.

Occasional Contributor

Re: TrafficScript Regular Expression error

Yes, I thought so.. You have tripped over a bug that was introduced in 9.3 and was remediated in 9.5

In the 9.5 Release Notes,

SR24693 The string.regexmatch() and string.regexsub() TrafficScript functions now

handle undefined strings correctly (fixes a regression introduced in 9.3).

New Contributor

Re: TrafficScript Regular Expression error

Ah, okay, thanks. I think we'll have to change the logic a little to get around this then, as I don't think we have the time to do a full application test (likely required to do an upgrade to 9.5).

Thanks,

Scott