I want to extract all words between "products" and / (forward slash) or period (.)
In the example below, I want to extract "pants" and "shoes"
www.site.com/products/pants.html
www.site.com/products/shoes/sneakers.html
The closest I came was this (?<=/products/).*($.|/)
How do I include "." OR "/"
CodePudding user response:
If nth occurance is e.g. two:
^(?:[^\/]*\/){2}([^.\/] )
^
start anchor(?:
non capturing group)
[^
negated character class]
- matches captured to group 1