I am having trouble writing a perl compatible regex to match a few different things when there is a gap between each condition. It makes more sense when I explain what I want it to find
Conditions
- /world/
- a single letter
- a dash OR underscore
- a single letter
- a single period
- three or four letters
The problem I have is I don't know how to write the expression such that there can be a gap between condition #1 and #2. Conditions #2 - #4 can repeat, but not always.
I've been using multiple online regex testers but I cannot get a match and I am not sure what I am doing wrong. I think regex is looking for /world/x_x
or /world/y-y
instead of "looking ahead" to match on the "letter dash letter" or "letter underscore letter" pattern.
Current regex
/world/([a-z](-|_)[a-z]){1,}\.[a-z]{3,4}$
Desired Matches (not currently matching)
hxxp://armassimchilzeispreu.blackjackipad.com/world/activate_available.jar
hxxp://chubfaceddamsel0.affittobarcheavela.it/world/eternal_threat-clearing.html
hxxp://offdestroyengarabitar.freebookofraslot.com/world/bonus-middle-marathon.pdf