is there a way to search directly on XHTML or Storage Format?

I am trying to see if there is way to enter a Confluence search query which finds pages containing a macro with specific parameters.  

Partial solution:  This actually still seems to work from a way back article by Sarah Maddox in so far as one can search:  macroName: x*

 OR  another helpful solution would be how to create something like a regex which searches XHTML or Storage Format for Confluence pages matching the criteria.

Thank you for any insights!!

2 answers

0 votes
Joe Xie Atlassian Team Jan 27, 2016

you can try using CQL to search for uses of macros (see, but that doesn't let you specify the parameters unfortunately.

Hi Brendan,

If you are willing to wirte a plugin, this is the code snippet to find macros and their parameters:


    MacroDefinitionHandler macroDefinitionHandler = new MacroDefinitionHandler() {

        public void handle(MacroDefinition macroDefinition) { 

            String macroName = macroDefinition.getName();                

            if (macroName != null && macroName.equals(MACRO_NAME)) { 





    try {

        xhtmlContent.handleMacroDefinitions(pageInStorageFormat, conversionContext, macroDefinitionHandler);


    catch (XhtmlException e) {

        throw new PtcException("Couldn't extract button name from MACRO_NAME.",e);



I hope this gives you a good starting point.


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Feb 06, 2019 in Confluence

Try out the new editing experience

Hi team, I’m Avinoam, a product manager on Confluence Cloud, and today I’m really excited to let the Community know that all customers can now try out the new editing experience and see some of the ...

1,015 views 51 8
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you