1. 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...

Discussion in 'XenForo Development Discussions' started by Jaxel, Jul 26, 2013.

  1. Jaxel

    Jaxel Well-Known Member

    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...

    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?
  2. Jeremy

    Jeremy Well-Known Member

    Turn /media/ into a generic:

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

    Jaxel Well-Known Member

    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.

Share This Page