1

product-resource/monitor-arms/cutsheets/edge

I am trying to get "cutsheets" from the string above. I was trying to select the last "/" and get everything up to the previous "/".

Do you have any idea how to do this?

Thanks for the help-

Reyjay
  • 61
  • 8

3 Answers3

0

Your reasoning seems good. This should match what you need: \/([^\/]+?)\/[^\/]+?$.

Example here.

npinti
  • 51,070
  • 5
  • 71
  • 94
0

You can simply use .*/.*/(.*)/.*

(P.S. the code pasted by npinti got my the 2nd word, i.e. 'monitor-arms'. I used Expresso to check)

H.Wolper
  • 689
  • 1
  • 13
  • 26
0

You could try this regex to capture the string cutsheets,

.*\/(.*)\/

OR

.*\/(.*)\/.*$

DEMO

Avinash Raj
  • 166,785
  • 24
  • 204
  • 249