mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
only use new RegExp(...) to define regex (not slashes)
This commit is contained in:
parent
6ba4da9711
commit
3435192640
2 changed files with 19 additions and 6 deletions
|
|
@ -190,10 +190,19 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
this.searching.set(true);
|
this.searching.set(true);
|
||||||
|
|
||||||
const reOperator1 = /^((?<operator>[\p{Letter}\p{Mark}]+):|(?<abbrev>[#@]))(?<value>[\p{Letter}\p{Mark}]+)(\s+|$)/iu;
|
const reOperator1 = new RegExp(
|
||||||
const reOperator2 = /^((?<operator>[\p{Letter}\p{Mark}]+):|(?<abbrev>[#@]))(?<quote>["']*)(?<value>.*?)\k<quote>(\s+|$)/iu;
|
'^((?<operator>[\\p{Letter}\\p{Mark}]+):|(?<abbrev>[#@]))(?<value>[\\p{Letter}\\p{Mark}]+)(\\s+|$)',
|
||||||
const reText = /^(?<text>\S+)(\s+|$)/u;
|
'iu',
|
||||||
const reQuotedText = /^(?<quote>["'])(?<text>[\w\p{L}]+)\k<quote>(\s+|$)/u;
|
);
|
||||||
|
const reOperator2 = new RegExp(
|
||||||
|
'^((?<operator>[\\p{Letter}\\p{Mark}]+):|(?<abbrev>[#@]))(?<quote>["\']*)(?<value>.*?)\\k<quote>(\\s+|$)',
|
||||||
|
'iu',
|
||||||
|
);
|
||||||
|
const reText = new RegExp('^(?<text>\\S+)(\\s+|$)', 'u');
|
||||||
|
const reQuotedText = new RegExp(
|
||||||
|
'^(?<quote>["\'])(?<text>.*?)\\k<quote>(\\s+|$)',
|
||||||
|
'u',
|
||||||
|
);
|
||||||
|
|
||||||
const operators = {
|
const operators = {
|
||||||
'operator-board': 'boards',
|
'operator-board': 'boards',
|
||||||
|
|
|
||||||
|
|
@ -1263,12 +1263,16 @@ function boardRemover(userId, doc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Boards.uniqueTitle = title => {
|
Boards.uniqueTitle = title => {
|
||||||
const m = title.match(/^(?<title>.*?)\s*(\[(?<num>\d+)]\s*$|\s*$)/);
|
const m = title.match(
|
||||||
|
new RegExp('^(?<title>.*?)\\s*(\\[(?<num>\\d+)]\\s*$|\\s*$)'),
|
||||||
|
);
|
||||||
const base = escapeForRegex(m.groups.title);
|
const base = escapeForRegex(m.groups.title);
|
||||||
let num = 0;
|
let num = 0;
|
||||||
Boards.find({ title: new RegExp(`^${base}\\s*\\[\\d+]\\s*$`) }).forEach(
|
Boards.find({ title: new RegExp(`^${base}\\s*\\[\\d+]\\s*$`) }).forEach(
|
||||||
board => {
|
board => {
|
||||||
const m = board.title.match(/^(?<title>.*?)\s*\[(?<num>\d+)]\s*$/);
|
const m = board.title.match(
|
||||||
|
new RegExp('^(?<title>.*?)\\s*\\[(?<num>\\d+)]\\s*$'),
|
||||||
|
);
|
||||||
if (m) {
|
if (m) {
|
||||||
const n = parseInt(m.groups.num, 10);
|
const n = parseInt(m.groups.num, 10);
|
||||||
num = num < n ? n : num;
|
num = num < n ? n : num;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue