It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Export any marked text from the page.

Alexei Jun 03, 2016

Hello All.

Does anyone know how I might export all marked text from the page? (confluence 5.85)

Text can by bold/italic/underline.

 

Example

source text:

  1. On the Navigation menu, point to Customer Information Management and then click Residential Customers.
  2. On the toolbar of the Customer Accounts table, click New Residential Customer

export text:

Navigation

Customer Information Management

Residential Customers

New Residential Customer

 

Thank you.

1 answer

1 vote
Marcel Woschek Jul 21, 2016

You could write a small plugin extracting the body of the page and filter the content with a regular expression.

The page content is stored in XHTML so the bold text looks like this: <strong>some Text</strong>.

The RegEx might then look something like this: <strong>[A-z,-\s]+<\/strong>

To get the substrings out of the page content you might use something like this:

Pattern p0 = Pattern.compile("&lt;strong&gt;[A-z,-\s]+&lt;\/strong&gt;");
Matcher m = p0.matcher(pageContent);
while (m.find())
{
  System.out.printf("%s%n", m.group(1));
}

 

Edit:

I guess this RegEx should be even better, because it matches any character except line breaks. Also you need two backslashes, one for Java and one for the RegEx syntax:

Pattern p0 = Pattern.compile("&lt;strong&gt;(.*)&lt;\\/strong&gt;");

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Confluence

6 Awesome Ways to Apply Trello, JIRA and Confluence to your Project

I attended  Atlassian Summit 2019  and learned a lot from the presenters, attendees and knowledgeable Atlassian product managers. The presentations I attended focused on applying Agile, pla...

2,587 views 12 29
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you