Regex How to Include and Exclude in same expression

Document ID : KB000034711
Last Modified Date : 14/02/2018
Show Technical Document Details

Introduction

Regex How to Include and Exclude in same expression

 

 

Instructions:


select all hosts that have sjc but should not have nm in them.

This can be required in Distribution manager, nas alarm filters etc. You can use following regex to include certain characters in a name while excluding which have certain characters you don't want to include. Like in following example:

sjchyd
ussjcnimbu
uswestsjctada

If you want to get the ones which have "sjc" but not "nim" in them, use follwoing regex:

/(?!.*nim)sjc/