WordPress.org

Ready to get started?Download WordPress

Forums

Redirection
Cannot make Some Regex to work (4 posts)

  1. kopoba11
    Member
    Posted 2 years ago #

    Hi All,

    I successfully migrated from typepad to wordpress, right now I am in process cleaning up some broken links.

    I put bunch of expressions together some work and some do not, I hope someone can take a look and see if I did anything wrong.

    For example:

    /.m/(.*) => /$1 works but when I try to do the following

    /(d*)/(d*)/(.*)/(.*)/atom.xml =>http://ismashphone.com/comments/feed/
    or
    /(d*)/(d*)/(.*)/(.*)/atom.xml =>/$1/$2/$3.html/comments/feed/

    does not work, I am trying to match the following

    ​/2008​/08​/british​/comments​/rss.xml => ​/2008​/08​/british.html​/comments​/feed/

    same problem with
    /(d*)/(d*)/index.html => /$1/$2/
    trying to match
    /2011/07/index.html => /2011/07/

    Thanks in advance

  2. John Godley
    Member
    Plugin Author

    Posted 2 years ago #

    (d*) is not a valid regular expression. I think you mean (\d*)

    You may find this helpful:

    http://www.regular-expressions.info/

  3. kopoba11
    Member
    Posted 2 years ago #

    thanks john.

    (\d*) did the trick.

    make sure to fix that code on your main page

    http://urbangiraffe.com/plugins/redirection/

    you used it as example

    See code from your site
    < blockquote>
    /(d*)/(d*)/(.*)
    This pattern tells the plugin that you want to match a URL that looks like:

    /2007/05/some-url/
    </ blockquote>

  4. John Godley
    Member
    Plugin Author

    Posted 2 years ago #

    Odd, I don't know how the back slashes disappeared. Thanks for pointing it out

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic