• Forums
    • Public Forums
      • Community Connect
      • Dynatrace
        • Dynatrace Open Q&A
      • Application Monitoring & UEM
        • AppMon & UEM Open Q&A
      • Network Application Monitoring
        • NAM Open Q&A
  • Home /
  • Public Forums /
  • Application Monitoring & UEM /
  • AppMon & UEM Open Q&A /
avatar image
Question by Jose I. · Sep 15, 2014 at 08:11 PM ·

Regular Expression to take parts of a URI

Hi.

I'm tryingo to build a regular expression that takes part of a URI that could vary in function of where the customer is, for instance:

 

http://xxxxxxx.com/products

I'd like to get products.

 

http://xxxxxxx.com/products/furnitures

 

I'd like to get products/funitures

 

http://xxxxxxx.com/products/furnitures/tables.

I'd like to get products/furnitures/tables but nothing beyond this, I mean if I've

 

http://xxxxxxx.com/products/furnitures/tables/night_table.html


I'd like to get /products/furnitures/tables


But I don't know how to get it... I've build one, but get all the stuff from /product... including all the parts of the URI


And since the application has several thousands of products, I'm getting a lot of values that i don't want. Anyone knows how to build it?

 

Thanks in advance and best regards

JMI


Comment

People who like this

0 Show 0
10 |2000000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Toggle Comment visibility. Current Visibility: Viewable by all users

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

2 Replies

  • Sort: 
  • Most voted
  • Newest
  • Oldest
avatar image

Answer by Jose I. · Sep 16, 2014 at 02:53 AM

Thanks a lot!!! Now I've what i was looking for.

All the best

JMI

Comment

People who like this

0 Show 0 · Share
10 |2000000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Toggle Comment visibility. Current Visibility: Viewable by all users

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

avatar image

Answer by Jose I. · Sep 15, 2014 at 08:15 PM

sorry... I've explained it wrong... what i need to exclude is more than third category, the final part of the URI is excluded with the regex that I've build... I mean:

 

http://xxxxxxx.com/products/furnitures/tables/night_tables/special/night_table.html


I'd like to get /products/furnitures/tables and nothing else.


Thanks in advance and best regards

JMI

 

Comment

People who like this

0 Show 4 · Share
10 |2000000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Toggle Comment visibility. Current Visibility: Viewable by all users

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

avatar image Rick B. · Sep 15, 2014 at 11:53 PM 0
Share

does the following work?

(/[^/]*/[^/]*/[^/]*)

Rick B

avatar image Rick B. Rick B. · Sep 16, 2014 at 12:01 AM 0
Share

Oh wait, I re-read your original post.  here's the edited version:

(/[^/]+/?[^/]+/?[^/]+)

Edit: the limitation here is that the first URI part needs to be at least <regex> /... </regex> in order to match.  If you also need to match the case where the URI is simply "/" then the following should be used:

(\A/\Z|/[^/]+/?[^/]+/?[^/]+)
avatar image Lopes D. Rick B. · Sep 16, 2014 at 02:43 AM 0
Share

This one doesn't work for:

 

www.test.com/product/details.html

www.test.com/product/cat2/details.html

I think it should be:

com/([^/]+/?[^/]+/?[^/]+)/

Just so he doesn't get the host part and also excludes any last element that does not end with "/" such as .html, etc

Just be mindful that the request

www.test.com/product 

 

Won't match because there is no "/" at the end, not sure if we can have the best of both worlds, getting requests that don't end with a "/" and also not capturing the part of the request that ends with ".*"

 

avatar image Rick B. Lopes D. · Sep 16, 2014 at 02:47 AM 0
Share

the host isn't considered in the URI Part BT Measure.

Does the /product/details.html exist? That seems like it wouldn't...

How to get started

First steps in the forum
Read Community User Guide
Best practices of using forum

NAM 2019 SP5 is available


Check the RHEL support added in the latest NAM service pack.

Learn more

LIVE WEBINAR

"Performance Clinic - Monitoring as a Self Service with Dynatrace"


JANUARY 15, 3:00 PM GMT / 10:00 AM ET

Register here

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Forum Tags

dotnet mobile monitoring load iis 6.5 kubernetes mainframe rest api dashboard framework 7.0 appmon 7 health monitoring adk log monitoring services auto-detection uem webserver test automation license web performance monitoring ios nam probe collector migration mq web services knowledge sharing reports window java hybris javascript appmon sensors good to know extensions search 6.3+ server documentation easytravel web dashboard kibana system profile purelytics docker splunk 6.1 process groups account 7.2 rest dynatrace saas spa guardian appmon administration production user actions postgresql upgrade oneagent measures security Dynatrace Managed transactionflow technologies diagnostics user session monitoring unique users continuous delivery sharing configuration alerting NGINX splitting business transaction client 6.3 installation database scheduler apache mobileapp RUM php dashlet azure purepath agent 7.1 appmonsaas messagebroker nodejs 6.2 android sensor performance warehouse
  • Forums
  • Public Forums
    • Community Connect
    • Dynatrace
      • Dynatrace Open Q&A
    • Application Monitoring & UEM
      • AppMon & UEM Open Q&A
    • Network Application Monitoring
      • NAM Open Q&A