diff --git a/uni_modules/uts-tests/utssdk/String.uts b/uni_modules/uts-tests/utssdk/String.uts index 1c226a1439cd6b0faf0b077e799438c35870964c..8b347f1f4c7b946e1d33d3e933430d8cbc6a6837 100644 --- a/uni_modules/uts-tests/utssdk/String.uts +++ b/uni_modules/uts-tests/utssdk/String.uts @@ -189,13 +189,14 @@ export function testString(): Result { return p.join(' - '); } - const REGEX_FORMAT = /[YMDHhms]o|\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g - const formatStr = 'This is a [sample] text with [another] capture group.' - const nextStr = formatStr.replace(REGEX_FORMAT, (match:string, p1: string|null, offset: number, string: string):string =>{ - console.log('123', p1, match) - return p1 ?? match ?? '' - }) - expect(nextStr).toEqual('This is a sample text with another capture group.'); + // const REGEX_FORMAT = /[YMDHhms]o|\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g + // const formatStr = 'This is a [sample] text with [another] capture group.' + // const nextStr = formatStr.replace(REGEX_FORMAT, (match:string, p1: string|null, offset: number, string: string):string =>{ + // console.log('123', p1, match) + // return p1 ?? match ?? '' + // }) + // expect(nextStr).toEqual('This is a sample text with another capture group.'); + // var newString = str.replace(/([^\d]*)(\d*)([^\w]*)/, replacer); // expect(newString).toEqual("abc - 12345 - #$*%"); // const str1 = 'hello, world';