• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

preg matching urls with route changes...

Jaxel

Well-known member
#1
In one of my mods,I have the ability to add items to a playlist. One ofthe ways to add an item is to submit it's url. The way I've been doing this is with a regular expression match.

So if the url contains...
media/letters.int/video

It will get matched. However, with the new route changer, someone can easily change "media" to something else. If they do, then the regular expression stops working. How would I get around this with the new route changer?

Is there a better way to do url matching and parsing?
 

Jeremy

Well-known member
#2
Turn /media/ into a generic:
[a-z0-9]/letters.int/video

The chances of 2 add-ons implementing a /video action is minimal I think.
 

Jaxel

Well-known member
#3
Turn /media/ into a generic:
[a-z0-9]/letters.int/video

The chances of 2 add-ons implementing a /video action is minimal I think.
Yeah, but this isn't just for the video action. I use this system in a lot of my mods, with more generic words too. So using a general /w catch operator wouldn't work that well.

When I make my mods, I try to program around every eventuality. If something can be broken, I assume users are so stupid that they'll be able to figure it out.