Skip to content
New issue

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

replace(/[\n|\r\n]/g, '\\n') should be replace(/(\n|\r\n)/g, '\\n') #25

Open
ToFe19 opened this issue Dec 2, 2020 · 0 comments
Open

Comments

@ToFe19
Copy link

ToFe19 commented Dec 2, 2020

In the regular expression round brackets should be used:

replace(/(\n|\r\n)/g, '\n')
instead of
replace(/[\n|\r\n]/g, '\n')

otherwise the vertical | is replaced

Correct:
"good || bad".replace(/(\n|\r\n)/g, '\n'); -> 'good || bad'

Not correct:
"good || bad".replace(/[\n|\r\n]/g, '\n'); -> 'good \n\n bad'

Yahasana pushed a commit to Yahasana/templayed.js that referenced this issue Aug 26, 2021
1. Replace | with \n and no need to replace \n with \n. fixed archan937#25
2. Support for inner templates on lists. fixed archan937#8 
3. Loop over object properties. fixed archan937#13  and archan937#15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant