What is wrong w/ this regular expression? (3 posts)

  1. nclinuxtech
    Posted 4 years ago #

    I have about 3100 zip codes to enter into redirection so that when someone searches a zip code on my site it does a pass through to a designated URL on the site.

    However, zip codes have a similar pattern and I want to use regular expression to complete this task. Basically, instead of entering 28553, 28554, 28555, 28556, 28557, 28558 manually, I want to do it with regular expression.

    Right now I have as my source /?s=2855[3 4 5 6 7 8] and my target a URL on the site. I even did /?s=2855[3 4 5 6 7 8]$ However, both just take me nowhere and reloads the current page. I also tried /?s=2855* hoping to get everything from 28550-28559 but this too just reloads the current page and I don't even get the usual WordPress "sorry, no posts found for this search term"

    What am I missing?

  2. John Godley
    Plugin Author

    Posted 4 years ago #

    The examples you gave above are not valid regular expressions. There is a lot of information on various websites such as http://www.regular-expressions.info/, although I appreciate it may seem daunting.

    If you use \d this will match a number. Note that you will need to escape regular expression characters so something like: /\?=2855\d should match 28550-28559

    Also make sure you have the regex checkbox enabled.

  3. anim8tr
    Posted 4 years ago #

    Question... what type of RegEx does Redirection use. Is it Posix or something else?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Redirection
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic