【发布时间】:2014-01-22 03:42:51
【问题描述】:
我在 Javascript 中有以下 RegEx:
var re1 = '(~)';
var re2 = '([a-z])';
var re3 = '([a-z])';
var re4 = '(\\d)';
var re5 = '([a-z])';
var re6 = '(\\d)';
var matchExp = new RegExp(re1 + re2 + re3 + re4 + re5 + re6, ["i"]);
var match = window.location.href.match(matchExp);
var shortcode = match == null ? "" : match[1];
我在这里尝试的是短代码,我希望将 /~Xx0X0 等任何 url 重定向到 /create.html。 其中 X/x 是非空白字符,0 是数字。
如何在 .htaccess mod_rewrite 中使用正则表达式? 希望我的解释正确。
短代码格式
-
~
大写字符
小写字符
数字
大写字符
数字
【问题讨论】:
标签: javascript regex .htaccess mod-rewrite