0

I'm working on Angular 4 and I have a feature in application is render a file text with pure text (not parse to any structure) to html. I'm able to search a part of content on the text. Now I have a solution as the following:

Solution 1:

I would like to analyze the text, all text are wrapped in div element, that div contains multiple paragraph elements <p> content which separated by newline (line-break) in the file. Then go search keyword and to find out a <p> contains keyword, styling CSS highlight for specific text within <p> element. But I have googled but still not found any sample for this.

Maybe you will ask me why don't you parse all contents in one element tag. I think that it's more complicated for css styling and scrolling to position occurring keyword.

Therefore, I need some helps to find out for this case. Thank you in advance.

UPDATE:

Whether should I need to use find feature built-in of browser?

Triet Nguyen
  • 763
  • 9
  • 20
  • Hello... Are you familiar with this? https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags – Zze Oct 17 '19 at 05:33
  • Hi @Zze, I don't know that why I have to use regex to parse HTML. I can manipulate the text by creating element (for example `

    `) with sequence string. So what all I need is able to search a keyword to make only the keyword as highlight within `

    `. Do you know what I mean?

    – Triet Nguyen Oct 17 '19 at 06:32

0 Answers0