attilan

Preview

Jan 11th, 2021
648
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. generatePreview(group: FormGroup): Observable<string> {
  2.     const regex = /\[{2}[\p{L}\d ,.\-?!]+\]{2}/gimu;
  3.     return this.getSentences$(group).pipe(
  4.       map((sentencesString: string) => sentencesString || ''),
  5.       map((sentencesString: string) =>
  6.         sentencesString.replace(regex, (match: string) => {
  7.           const normalizedMatch = match.replace(/[[\]]/gimu, '');
  8.           return ` <mark class="custom-mark">${normalizedMatch}</mark>`;
  9.         })
  10.       ),
  11.       map((text: string) => text.replace(/\n/gimu, '<br>'))
  12.     );
  13.   }
RAW Paste Data