Skip to content

Commit

Permalink
fixed minor bug
Browse files Browse the repository at this point in the history
  • Loading branch information
seungwoochoe committed Jul 7, 2021
1 parent a4e1f4d commit f9d76f5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ const formatByPartOfSpeech = (text) => {

const breakLineProperly = (text) => {
partOfSpeech.forEach((element) => {
let regexWithParentheses = new RegExp(`(${element})\\<br\\>(\\(?[^\\<\\d]*?\\)?) ?(\\[.*?\\]) `, 'g');
text = text.replace(regexWithParentheses, `$1 $2 $3${linebreak}`);
let regexWithoutParentheses = new RegExp(`(${element})\\<br\\>(\\([^\\<\\d]*?\\)) `);
text = text.replace(regexWithoutParentheses, `$1 $2${linebreak}`);
let regexWithSquareBrackets = new RegExp(`(${element})\\<br\\>(\\(?[^\\<\\d]*?\\)?) ?(\\[.*?\\]) `, 'g');
text = text.replace(regexWithSquareBrackets, `$1 $2 $3${linebreak}`);
let regexWithoutSquareBrackets = new RegExp(`(${element})\\<br\\> *(\\([^\\<\\d]*?\\)) `);
text = text.replace(regexWithoutSquareBrackets, `$1 $2${linebreak}`);
})
return text;
}
Expand Down

0 comments on commit f9d76f5

Please sign in to comment.