Remove superfluous regex escapes

This commit is contained in:
Titus Wormer 2016-11-01 16:22:28 +01:00
parent a7000bcf4f
commit e16665140a
7 changed files with 8 additions and 8 deletions

View File

@ -29,7 +29,7 @@ var position = require('unist-util-position');
module.exports = definitionCase;
/* Expressions. */
var LABEL = /^\s*\[((?:\\[\s\S]|[^\[\]])+)\]/;
var LABEL = /^\s*\[((?:\\[\s\S]|[^[\]])+)]/;
/**
* Warn when definitions are not placed at the end of the

View File

@ -29,7 +29,7 @@ var position = require('unist-util-position');
module.exports = definitionSpacing;
/* Expressions. */
var LABEL = /^\s*\[((?:\\[\s\S]|[^\[\]])+)\]/;
var LABEL = /^\s*\[((?:\\[\s\S]|[^[\]])+)]/;
/**
* Warn when consecutive white space is used in a

View File

@ -128,7 +128,7 @@ function listItemIndent(ast, file, preferred) {
marker = contents.slice(initial, final);
/* Support checkboxes. */
marker = marker.replace(/\[[x ]?\]\s*$/i, '');
marker = marker.replace(/\[[x ]?]\s*$/i, '');
bulletSize = marker.trimRight().length;
tab = Math.ceil(bulletSize / 4) * 4;

View File

@ -49,7 +49,7 @@ module.exports = noFileNameIrregularCharacters;
* characters which should not be allowed.
*/
function noFileNameIrregularCharacters(ast, file, preferred) {
var expression = preferred || /[^\\\.a-zA-Z0-9-]/;
var expression = preferred || /[^\\.a-zA-Z0-9-]/;
var match;
if (typeof expression === 'string') {

View File

@ -106,7 +106,7 @@ function orderedListMarkerStyle(ast, file, preferred) {
marker = contents.slice(initial, final).replace(/\s|\d/g, '');
/* Support checkboxes. */
marker = marker.replace(/\[[x ]?\]\s*$/i, '');
marker = marker.replace(/\[[x ]?]\s*$/i, '');
if (!preferred) {
preferred = marker;

View File

@ -143,10 +143,10 @@ function orderedListMarkerValue(ast, file, preferred) {
return;
}
marker = contents.slice(initial, final).replace(/[\s\.\)]/g, '');
marker = contents.slice(initial, final).replace(/[\s.)]/g, '');
/* Support checkboxes. */
marker = Number(marker.replace(/\[[x ]?\]\s*$/i, ''));
marker = Number(marker.replace(/\[[x ]?]\s*$/i, ''));
if (marker !== shouldBe) {
file.message('Marker should be `' + shouldBe + '`, was `' + marker + '`', item);

View File

@ -101,7 +101,7 @@ function unorderedListMarkerStyle(ast, file, preferred) {
marker = contents.slice(initial, final).replace(/\s/g, '');
/* Support checkboxes. */
marker = marker.replace(/\[[x ]?\]\s*$/i, '');
marker = marker.replace(/\[[x ]?]\s*$/i, '');
if (!preferred) {
preferred = marker;