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,780
  • 5
  • 72
  • 96
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
  • 699
  • 1
  • 13
  • 26
0

You could try this regex to capture the string cutsheets,

.*\/(.*)\/

OR

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

DEMO

Avinash Raj
  • 172,303
  • 28
  • 230
  • 274