本文整理汇总了TypeScript中vs/base/common/strings.escapeRegExpCharacters函数的典型用法代码示例。如果您正苦于以下问题:TypeScript escapeRegExpCharacters函数的具体用法?TypeScript escapeRegExpCharacters怎么用?TypeScript escapeRegExpCharacters使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了escapeRegExpCharacters函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: _createCloseBracketRegExp
private static _createCloseBracketRegExp(bracket: string): RegExp {
var str = strings.escapeRegExpCharacters(bracket);
if (!/\B/.test(str.charAt(str.length - 1))) {
str = str + '\\b';
}
str = '^\\s*' + str;
return OnEnterSupport._safeRegExp(str);
}
开发者ID:Chan-PH,项目名称:vscode,代码行数:8,代码来源:onEnter.ts
示例2: _createOpenBracketRegExp
private static _createOpenBracketRegExp(bracket: string): RegExp {
var str = strings.escapeRegExpCharacters(bracket);
if (!/\B/.test(str.charAt(0))) {
str = '\\b' + str;
}
str += '\\s*$';
return OnEnterSupport._safeRegExp(str);
}
开发者ID:Chan-PH,项目名称:vscode,代码行数:8,代码来源:onEnter.ts
示例3: RegExp
workspaceFolderVariants.forEach(workspaceFolderVariant => {
const validPathCharacterPattern = '[^\\s\\(\\):<>"]';
const validPathCharacterOrSpacePattern = `(?:${validPathCharacterPattern}| ${validPathCharacterPattern})`;
const pathPattern = `${validPathCharacterOrSpacePattern}+\\.${validPathCharacterPattern}+`;
const strictPathPattern = `${validPathCharacterPattern}+`;
// Example: /workspaces/express/server.js on line 8, column 13
patterns.push(new RegExp(strings.escapeRegExpCharacters(workspaceFolderVariant) + `(${pathPattern}) on line ((\\d+)(, column (\\d+))?)`, 'gi'));
// Example: /workspaces/express/server.js:line 8, column 13
patterns.push(new RegExp(strings.escapeRegExpCharacters(workspaceFolderVariant) + `(${pathPattern}):line ((\\d+)(, column (\\d+))?)`, 'gi'));
// Example: /workspaces/mankala/Features.ts(45): error
// Example: /workspaces/mankala/Features.ts (45): error
// Example: /workspaces/mankala/Features.ts(45,18): error
// Example: /workspaces/mankala/Features.ts (45,18): error
// Example: /workspaces/mankala/Features Special.ts (45,18): error
patterns.push(new RegExp(strings.escapeRegExpCharacters(workspaceFolderVariant) + `(${pathPattern})(\\s?\\((\\d+)(,(\\d+))?)\\)`, 'gi'));
// Example: at /workspaces/mankala/Game.ts
// Example: at /workspaces/mankala/Game.ts:336
// Example: at /workspaces/mankala/Game.ts:336:9
patterns.push(new RegExp(strings.escapeRegExpCharacters(workspaceFolderVariant) + `(${strictPathPattern})(:(\\d+))?(:(\\d+))?`, 'gi'));
});
开发者ID:jumpinjackie,项目名称:sqlopsstudio,代码行数:24,代码来源:outputLinkComputer.ts
示例4: prepareBracketForRegExp
function prepareBracketForRegExp(str: string): string {
// This bracket pair uses letters like e.g. "begin" - "end"
const insertWordBoundaries = (/^[\w]+$/.test(str));
str = strings.escapeRegExpCharacters(str);
return (insertWordBoundaries ? `\\b${str}\\b` : str);
}
开发者ID:DonJayamanne,项目名称:vscode,代码行数:6,代码来源:richEditBrackets.ts
注:本文中的vs/base/common/strings.escapeRegExpCharacters函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论