nginx:重写正则表达式以匹配末尾无数字的URL

时间:2018-08-31 16:10:12

标签: regex nginx regex-lookarounds nginx-location

我正在尝试建立一个重写规则来完成以下任务:

  • #include <QCoreApplication> #include <QThreadPool> #include "TaskRunner.h" // comment to switch #define USE_QTHREAD int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); auto runner = new TaskRunner(42); #ifdef USE_QTHREAD // option 1: on a QThread auto thread = new QThread(&a); runner->moveToThread(thread); QObject::connect(thread, &QThread::finished, runner, &QObject::deleteLater); Q_EMIT runner->start(); // stop condition not shown #else // option 2: in a thread pool QObject::connect( runner, &TaskRunner::starting, runner, &QObject::moveToThread, Qt::BlockingQueuedConnection); QThreadPool::globalInstance()->start(runner); // stop condition not shown #endif return a.exec(); } -> /base/{first}

  • /base/search/{first}-> /base/{first}/{second}

当然,/base/search/{first}/{second}不应重定向到/base/search/{first}

/base/search/search/{first}{first}是带有字母字符和破折号(无数字)的字符串的占位符。

但是,我不想重写以下URL:

  • {second}

/base/{first}/{second}/{third}/{123}是仅三个字符的数字字符串的占位符

我尝试了以下位置限制,并且可以得到前两个要求,但它也捕获了以{123}结尾的URL。

{123}

0 个答案:

没有答案