Searching: Wildcard in the middle of a string


#1

Hi,

I’m looking for a way to use this for dynamic groups. I thought EH used regex natively but it doesn’t seem to work (unless I’m missing something).

Example: I’m trying to find hosts that have the string, “www-” in the beginning and the string “prod.com” at the end.


#2

Hi @pharrold!

In your custom group criteria, try this:

/^www-.*prod\.com$/

Let us know if that works.


#3

That did it. Thanks!

So I guess “/” enters regex mode in the search, and the second “/” terminates regex mode?


#4

Exactly right! Nice pickup.

Without the forward slashes, the string is basically doing a partial match.

Good luck in your Extrahopping! If you feel I have answered your question, please take a moment to show it as a solution to help others with the same question.


#5

Done. Thanks again.