- Mark as New
- Subscribe to RSS Feed
- Permalink
‎21 Apr 2021
09:23 PM
- last edited on
‎30 Jun 2021
02:10 PM
by
MaciejNeumann
I am stumped! I am trying to setup a service naming rule using the Detected Service Name. In this case, I would only like the bolded text - (/mothership). How do I extract only this word using Regex?
I have tried -
- ^[a-zA-Z0-9]*+
-
\/(?>.+)
For these attempts, I get close, but still have varying results. I want to remove the slash and the () and only have the word.
What I really want is this...
Detected Service Name - "Default Web Site:80 (/mothership)" >>>>> "mothership"
{Service:DetectedName]
Web Request Service; .NET
Detected service name contains regex
Solved! Go to Solution.
- Labels:
-
naming rules
-
regex
-
services classic
- Mark as New
- Subscribe to RSS Feed
- Permalink
‎17 Jun 2021 10:23 PM
While this is very primitive, you could try (..........).$ but then again that would be static on the number of characters
- Mark as New
- Subscribe to RSS Feed
- Permalink
‎30 Jun 2021 05:31 PM - edited ‎30 Jun 2021 05:33 PM
Have you considered just skipping the regex entirely and using the {Service:WebContextRoot} placeholder?
You could then remove the slash with regex if really needed...
- Mark as New
- Subscribe to RSS Feed
- Permalink
‎29 Jul 2021 05:08 PM
While a good answer, this solution doesn't completely solve the problem. I'd like to clean up the default name which includes ":80 (/app)" or ":80, :443 (/app)", etc. and only have the name of the app pool or web request service. The goal here is to clean up these extraneous characters as they are being imported into ServiceNow.
- Mark as New
- Subscribe to RSS Feed
- Permalink
‎29 Jul 2021 05:31 PM
What output are you looking for specifically? Can you provide another example? This screenshot shows a preview of how Dave's rule above would work - does this not match your initial request?
Dynatrace Certified Professional
- Mark as New
- Subscribe to RSS Feed
- Permalink
‎29 Jul 2021 05:55 PM
Solution works.
