|
@@ -2,8 +2,9 @@ import * as pathUtils from '../utils/path-utils';
|
|
|
|
|
|
|
|
// https://regex101.com/r/BahpKX/2
|
|
// https://regex101.com/r/BahpKX/2
|
|
|
const PATTERN_INCLUDE_DATE = /^(.+\/[^/]+)\/(\d{4}|\d{4}\/\d{2}|\d{4}\/\d{2}\/\d{2})$/;
|
|
const PATTERN_INCLUDE_DATE = /^(.+\/[^/]+)\/(\d{4}|\d{4}\/\d{2}|\d{4}\/\d{2}\/\d{2})$/;
|
|
|
-// https://regex101.com/r/HJNvMW/1
|
|
|
|
|
-const PATTERN_DEFAULT = /^((.*)(?<!<)\/)?(.+)$/;
|
|
|
|
|
|
|
+
|
|
|
|
|
+// (?<!filename)\.js$
|
|
|
|
|
+// ^(?:(?!filename\.js$).)*\.js$
|
|
|
|
|
|
|
|
export class DevidedPagePath {
|
|
export class DevidedPagePath {
|
|
|
|
|
|
|
@@ -34,6 +35,14 @@ export class DevidedPagePath {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ let PATTERN_DEFAULT = /^((.*)\/)?(.+)$/;
|
|
|
|
|
+ try { // for non-chrome browsers
|
|
|
|
|
+ PATTERN_DEFAULT = /^((.*)(?<!<)\/)?(.+)$/; // https://regex101.com/r/HJNvMW/1
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (err) {
|
|
|
|
|
+ // lookbehind regex is not supported on non-chrome browsers
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const matchDefault = pagePath.match(PATTERN_DEFAULT);
|
|
const matchDefault = pagePath.match(PATTERN_DEFAULT);
|
|
|
if (matchDefault != null) {
|
|
if (matchDefault != null) {
|
|
|
this.isFormerRoot = matchDefault[1] === '/';
|
|
this.isFormerRoot = matchDefault[1] === '/';
|