We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$
I am trying to replace each newline with </s>, and to also add </s> to the very end. However if it ends with a newline I only want one </s>.
</s>
I wrote a regular expression for this using $, however this does not seem supported.
Some sample code (TS):
(async function test() { console.log('runnig test'); const text = ` first line second line third line`.trimStart(); let result = ''; const readStream = Readable .from(text) .pipe(replaceStream(/\s*[\n\r]+|$/g, ' </s>')); const writable = new Writable({ write(chunk: string) { result += chunk; } }); readStream.pipe(writable); await finished(readStream); console.log('Done! Result:'); console.log('---') console.log(result); console.log('---') })();
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I am trying to replace each newline with
</s>
, and to also add</s>
to the very end. However if it ends with a newline I only want one</s>
.I wrote a regular expression for this using $, however this does not seem supported.
Some sample code (TS):
The text was updated successfully, but these errors were encountered: