regex consistency

master
Aevann 2023-09-15 01:22:10 +03:00
parent a12790622d
commit 1b3e59b7a7
1 changed files with 4 additions and 4 deletions

View File

@ -4,11 +4,11 @@ marked.use({
name: 'mention', name: 'mention',
level: 'inline', level: 'inline',
start: function(src){ start: function(src){
const match = src.match(/@[a-zA-Z0-9_\-]+/); const match = src.match(/@[\w\-]{1,30}/);
return match != null ? match.index : -1; return match != null ? match.index : -1;
}, },
tokenizer: function(src) { tokenizer: function(src) {
const rule = /^@[a-zA-Z0-9_\-]+/; const rule = /^@[\w\-]{1,30}/;
const match = rule.exec(src); const match = rule.exec(src);
if (match){ if (match){
return { return {
@ -28,11 +28,11 @@ marked.use({
name: 'group_mention', name: 'group_mention',
level: 'inline', level: 'inline',
start: function(src){ start: function(src){
const match = src.match(/![a-zA-Z0-9_\-]+/); const match = src.match(/![\w\-]{3,25}/);
return match != null ? match.index : -1; return match != null ? match.index : -1;
}, },
tokenizer: function(src) { tokenizer: function(src) {
const rule = /^![a-zA-Z0-9_\-]+/; const rule = /^![\w\-]{3,25}/;
const match = rule.exec(src); const match = rule.exec(src);
if (match){ if (match){
return { return {