Reply

Regex Search Excluding terms

Not applicable
Posts: 2
3094     0

G'Day everyone.  I can search for Host records with the name containing a keyword (for example loopback) by doing this:

>>> Host.find(session).whereRegex('name', '(loopback)' ).all()
[<Host name=bba-320-tsv-01-loopback1.net.uow.edu.au ipv4addrs=[<HostIPv4 ipv4addr.....

 

How would I go about exlcuding any host with loopback in its name?  

>>> Host.find(session).whereRegex('name', '(!loopback)' ).all()
[]

 

Alternatively, is there a programatic way of pulling down the entire zone file?  If I search for everything it won't return in JSON as it's >1000 records.  Would I need to ignore the API alltogether and setup a zone transfer?

regex

Authority
Posts: 39
3095     0

I've tried it on http://regex101.com/ and the following will return "no match" when the string contains "loopback"

^((?!loopback).)*$

Showing results for 
Search instead for 
Did you mean: 

Recommended for You