Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4832

Groups possible in Regexs? Alternatives?

$
0
0

@dsfh2992 wrote:

So, I have an application that connects via TCP, and the first thing the client sends is a JSON string containing latitude and longitude coordinates. I want to choose the backend based on the lat/lon coordinates.

If I try to create an ACL like this:

acl americas req.payload(0,0) -m reg '"lon": -0*+(?:1[0-8][0-9]|[3-9][0-9]|29).\d{2}.+"lat": -?0*(?:90|[1-8]?[0-9]).\d{2}'

I get the error: error detected while parsing ACL 'americas' : regex '"lon": -0*+(?:1[0-8][0-9]|[3-9][0-9]|29).\d{2}.+"lat": -?0*(?:90|[1-8]?[0-9]).\d{2}' is invalid.

Based on trial and error, I can see that the limiting factor is the use of parenthesis (). I can change the statement to no longer use parenthesis by breaking it out into multiple regexs, but is there a better way? Any suggestions?

Thanks,
Dan

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4832

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>