textlint-rule / sentence-splitter

Split {Japanese, English} text into sentences.
https://sentence-splitter.netlify.app/
MIT License
118 stars 14 forks source link

Android phone error: Invalid regular expression: /^\p{Uppercase_Letter}/u: Invalid property name #52

Closed iibrat closed 5 months ago

iibrat commented 5 months ago

Describe the bug I apologize, I am learning and developing at the same time. I am not sure how to solve this problem. If you are willing, please help me take a look.

WeChat Mini Program Android error: Invalid regular expression: /^\p{Uppercase_Letter}/u: Invalid property name。 iOS OK。

import { split } from 'sentence-splitter' this.actionSegment.sentences = split(this.actionSegment.content) // 切割句子

<SyntaxError: Invalid regular expression: /^\p{Uppercase_Letter}/u: Invalid property name> SyntaxError: Invalid regular expression: /^\p{Uppercase_Letter}/u: Invalid property name at new RegExp () at isCapitalized (https://usr/appservice.app.js:16071:10)
at AbbrMarker.mark (https://usr/appservice.app.js:16166:11)
at https://usr/appservice.app.js:16042:27
at Array.forEach () at AnyValueParser.seek (https://usr/appservice.app.js:16041:24)
at SourceCode.seekNext (https://usr/appservice.app.js:15869:14)
at SplitParser.nextValue (https://usr/appservice.app.js:16320:48)
at Object.split (https://usr/appservice.app.js:16415:19)
at https://usr/appservice.app.js:16810:58

azu commented 5 months ago

I have never touched WeChat Mini program, but Unicode character class escape: \p{...}, \P{...} error seems to be there.

Can you tell me the result of running the following code on WeChat Mini program?

/^\p{Uppercase_Letter}/u.test("AAA");
// This one will probably give an error on wechat mini program

and

/^\p{General_Category=Uppercase_Letter}/u.test("AAA");
// I'd like to know the result of this one

📝 In specification, General_Category= can be omitted, but JS engine of WeChat Mini may treat it as different.

iibrat commented 5 months ago

It works fine when I downgrade to version 3.2.3. Thinks! I don't know why my cloud development environment has to limit the Node.js version to 12.

azu commented 5 months ago

/^\p{Uppercase_Letter}/u is introduced in https://github.com/textlint-rule/sentence-splitter/releases/tag/v4.4.0