@node-novel/pattern-split
v1.1.82
Published
try output RegExp Pattern as readable string list
Maintainers
Readme
@node-novel/pattern-split
try output RegExp Pattern as readable string listinstall
# 使用 yarn / Using yarn
yarn add @node-novel/pattern-split
# 使用 yarn-tool / Using yarn-tool
yarn-tool add @node-novel/pattern-split
# yt 是 yarn-tool 的別名 / yt is an alias for yarn-tool
yt add @node-novel/pattern-split
# 使用 pnpm / Using pnpm
pnpm add @node-novel/pattern-split
# 使用 npm / Using npm
npm install @node-novel/pattern-splitAPI: index.d.ts
demo
import novelPatternSplit = require('@node-novel/pattern-split');
let tests = [
`(女佣|女僕)`,
`女佣|女僕`,
`(?:女佣|女僕)`,
];
tests.forEach(function (input)
{
let ret1 = novelPatternSplit(input);
let ret2 = novelPatternSplit(input, {
breakingMode: true,
});
console.dir({
ret1,
ret2,
}, {
depth: null,
colors: true,
});
});{ ret1: [ '(女佣|女僕)' ], ret2: [ '女佣', '女僕' ] }
{ ret1: [ '女佣', '女僕' ], ret2: [ '女佣', '女僕' ] }
{ ret1: [ '女佣', '女僕' ], ret2: [ '女佣', '女僕' ] }