How to extract content between hidden text using C#

I want to take content between hidden items(or invisible items). For each paragraph under heading has a one or two paragraph. Each paragraph starts with a hidden word and ends with a another hidden word. I as show in the sample. (41.0 KB)

As you can see in the uploaded sample, |p| or |r| will be the opening word for the paragraph, and |/p| or |/r| will be the ending word for the paragraph.

I want to get the paragraph between the hidden words. Please help me to find a way for this feature.


In your case, we suggest you following solution.

  1. Find the start tag e.g. |p| or |r|.
  2. Move the cursor to this matched node and insert BookmarkStart node.
  3. Do the same for end tag and insert BookmarkEnd node.
  4. Extract the content from bookmark.

Please read the following articles.
Find and Replace
How to Extract Selected Content Between Nodes in a Document
Hope this helps you.