How To search for specific Sourcecode?

Hello,

In Confluence I want to search for a specific part of the source Code of my page.

In fact I want to check IF this is part of my source Code:

<tr>  
    <th> USER </th>  
    <td>       
<div class="content-wrapper">   
       <p>         
   <br/>        
  </p>      
  </div>     
</td>   
</tr>

Source Code that Looks like this should not be detected : 

<tr> 
     <th> USER </th>  
    <td>      
  <div class="content-wrapper">     
     <p>     
       <ac:link>      
        <ri:user ri:userkey="xxxx"/>     
       </ac:link>  
        </p>      
  </div>   
   </td>
</tr>   

 Thanks!

1 answer

This widget could not be displayed.
Stephen Deutsch Community Champion Jan 25, 2018

I was going to suggest the Confluence Source Editor, but I found out that it doesn't support multi-line searches.

I think your best bet would be to click the "View Storage Format" option on the ••• menu and search that using something like Notepad++ that supports Regular Expression search. Then you could just search for something like 

<th>\s*USER\s*<\/th>\s*<td>\s*<div class="content-wrapper">\s*<p>\s*<br\/>\s*<\/p>

If you want to replace it with something else, you could do a search and replace and use the technique I wrote in this answer to change the source code:

https://community.atlassian.com/t5/Confluence-questions/Editing-Source-Code-in-Confluence/qaq-p/129384

However, this would only work for one page. If you want to do the search on multiple pages, then you might consider using the Confluence CLI app, which I believe also supports regex search.

Hello Stephen,

 

Thanks a lot for your Reply. Unfortunately, due to my bad description it is not applicable to my problem.

My aim is to Display all pages that have this "string of Code" in its source Code.

Best,

 

Paul

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

403 views 4 6
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