【发布时间】:2017-08-06 05:16:09
【问题描述】:
export class Regex {
public static readonly BLANK = /^\s+$/;
public static readonly DIGITS = /^[0-9]*$/;
}
如何为 Regex 类创建扩展方法?我想在需要的地方使用 Regex.Blank.toString()
【问题讨论】:
-
如果你想要
toString方法的正则表达式,那么RegExp类中已经有一个属性叫做source。
标签: javascript regex typescript