tsbase
Version:
Base class libraries for TypeScript
58 lines (57 loc) • 1.86 kB
TypeScript
/**
* Regular Expressions and Utilities
*/
export declare class Regex {
private constructor();
static readonly NonAlphaNumeric: RegExp;
static readonly AnyString: RegExp;
static readonly WhiteSpace: RegExp;
static readonly XmlTag: RegExp;
static readonly CsvData: RegExp;
/**
* Matches: whatever@somewhere.museum | foreignchars@myforeigncharsdomain.nu | me+mysomething@mydomain.com
*
* Non-Matches: a@b.c | me@.my.com | a@b.comFOREIGNCHAR
*/
static readonly Email: RegExp;
/**
* Matches: http://regxlib.com/Default.aspx | http://electronics.cnet.com/electronics/0-6342366-8-8994967-1.html
*
* Non-Matches: www.yahoo.com
*/
static readonly Uri: RegExp;
/**
* Matches: 1234-1234-1234-1234 | 1234 1234 1234 1234 | 1234123412341234
*
* Non-Matches: Visa | 1234 | 123-1234-12345
*/
static readonly CreditCard: RegExp;
/**
* Matches: (111) 222-3333 | 1112223333 | 111-222-3333
*
* Non-Matches: 11122223333 | 11112223333 | 11122233333
*/
static readonly USPhoneNumber: RegExp;
/**
* Matches: $3,023,123.34 | 9,876,453 | 123456.78
*
* Non-Matches: 4,33,234.34 | $1.234 | abc
*/
static readonly USCurrency: RegExp;
/**
* Matches: 14467 | 144679554 | 14467-9554
*
* Non-Matches: 14467 955 | 14467- | 1446-9554
*/
static readonly USPostalCode: RegExp;
/**
* Executes the given RegExp on a string returning the final aggregated value after
* running the aggregator across all matches.
* @param regex
* @param str
* @param initialValue
* @param aggregator
* @returns
*/
static AggregateMatches<T>(regex: RegExp, str: string, initialValue: T, aggregator: (match: RegExpExecArray | undefined | null, currentValue: T) => void): T;
}