How To search for specific Sourcecode?

paul enggruber January 24, 2018

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

0 votes
Stephen Deutsch
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 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.

paul enggruber January 25, 2018

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
TAGS
AUG Leaders

Atlassian Community Events