文本分割
在浏览器中按1—20字符字面量分隔符、最长500字符正则、固定Unicode单位长度或精确均衡块数分割文本;空字面量可按显示字素簇或Unicode码点拆分,支持修剪、空块移除、块前后文本和七种输出分隔符。输入最多100,000字符,正则在临时Web Worker中执行并在1秒后终止,结果最多50,000块、500,000字符。
使用步骤
如何使用
- Enter up to 100,000 characters and choose one of four split methods.
- Set the method-specific boundary plus optional trimming, empty-piece removal, wrappers, and output separator.
- Split the text, review the retained pieces, then copy the result or download a text file.
Four defined split methods
Literal mode matches the separator exactly; an empty literal separator splits into displayed grapheme clusters or Unicode code points. Regular-expression mode uses the browser RegExp engine with the Unicode flag and optional ignore-case, multiline, and dot-all flags. Fixed-length mode groups the selected Unicode units by a maximum size. Exact-piece mode distributes the units as evenly as possible, giving the first pieces one extra unit when division has a remainder.
Regex isolation and practical limits
Regular expressions run in a temporary Web Worker that is terminated after one second, keeping a pathological expression from freezing the page. Capturing groups follow JavaScript split semantics and can appear as output pieces; use a noncapturing group when that is not wanted. Input is limited to 100,000 UTF-16 characters, the retained result to 50,000 pieces, and final output to 500,000 UTF-16 characters.
常见问题
你可能还想知道
Does the literal separator treat dots or brackets as regex?
No. Every character in a literal separator is matched exactly. Choose Regular expression only when you intentionally want regex syntax.
Will emoji and combining characters stay together?
Choose displayed grapheme clusters for empty-separator, fixed-length, or exact-piece splitting. Code-point mode intentionally treats the underlying Unicode scalar values separately.
Why did regex capturing groups appear in the result?
JavaScript split inserts matched capturing-group text between the surrounding pieces. Change groups such as (abc) to noncapturing groups such as (?:abc) when you only want them to define a boundary.