How do I search Confluence for an external URL?
Asked by Mandy Grover:

I need to find all the instances of an external URL in our wiki. Is there any way to do this through an advanced search?


Answers:
author: Miranda Rawson
body: Hi Mandy,

There are some limitations with the Confluence search. We had an existing [feature request](https://jira.atlassian.com/browse/CONFSERVER-27503)to extend the search capabilities, but this has since been closed. Your best bet will be to use the workaround described here: [https://confluence.atlassian.com/confkb/how-to-perform-a-confluence-site-search-for-keywords-and-links-through-the-database-830284252.html.](https://confluence.atlassian.com/confkb/how-to-perform-a-confluence-site-search-for-keywords-and-links-through-the-database-830284252.html.?) This involves using the Confluence database instead.

Kind regards,

Miranda Rawson

comments: author: Atlassian Sales
body: The link above is not working.


author: AnnWorley
body: Here is an updated link: [How to perform a Confluence site search for keywords and links through the database](https://confluence.atlassian.com/confkb/how-to-perform-a-confluence-site-search-for-keywords-and-links-through-the-database-830284252.html)

In case there is an issue accessing it, here is an excerpt:
> For an example, an external URL was inserted to numerous pages but as time goes by, those URL might point to a dead link as there might be some changes in the subdomain/URL path.
>
> Solution  
> To search for these contents, run the SQL query below on your Confluence database. Replace the \<INSERT_KEYWORD_HERE\> with your keyword. The % symbol represents a wildcard search.  
> The SQL results will return the content type, title along with the space details including the spacestatus (either CURRENT or ARCHIVED). If a space is Archived, it won't be searchable in Confluence's User Interface.

```
select c.CONTENTTYPE,c.TITLE, s.SPACENAME, s.SPACEKEY, s.SPACETYPE, s.SPACESTATUS 
from content c join spaces s on c.SPACEID=s.SPACEID 
where CONTENTID in 
(select CONTENTID from bodycontent where BODY like '%<INSERT_KEYWORD_HERE>%')
```


author: Davin Studer
body: There is a little known feature of Confluence search in that is can also do regular expression searches. Try doing this for your search ...

```
/.*{your url here}.*/
```

Now, you will have to format the url to escape out any regular expression reserved characters. The biggest one would be periods. but if you have any of these characters in the url you would need to change them. See below for replacements

```
\? ? ->? ? \\
.    ->    \.
(    ->    \(
)    ->    \)
[    ->    \[
^? ? ->? ??\^
$? ? ->? ??\$
|? ? ->? ? \|
*? ? ->? ? \*
+? ? ->? ? \+
?? ? ->? ? \?
{? ? ->? ? \{
```

So if you url was <https://www.google.com/stuff+things> you would search using this syntax ...

```
/.*https://www\.google\.com/stuff\+things.*/
```

comments: author: Mandy Grover
body: [@Davin Studer](/t5/user/viewprofilepage/user-id/781467)

This is really interesting (and I didn't know about regex in Confluence at all). But would this show me the instances of URL if the full URL appeared on the page OR would this show me if the URL occurred in the source?


author: Paul Mansfield
body: I tried that and I got a system error and a HUGE stack trace; am self-hosted running Confluence 6.9.3 on CentOS6.

[![logo](http://confluence/images/logo/confluence_48_white.png "Confluence")](http://confluence/)System Error {#toc-hId-1850590941}
-----------------------------------------------------------------------------------------------------------------------------------

### Cause {#toc-hId--898079525}

java.lang.IllegalArgumentException: integer expected at position 3  
at org.apache.lucene.util.automaton.RegExp.parseRepeatExp(RegExp.java:896)

#### Stack Trace:\[hide\] {#toc-hId-648217305}

```
java.lang.IllegalArgumentException: integer expected at position 3 at org.apache.lucene.util.automaton.RegExp.parseRepeatExp(RegExp.java:896) at org.apache.lucene.util.automaton.RegExp.parseConcatExp(RegExp.java:880)

... etc ....

??? at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
?? ?at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539)
?? ?at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)
?? ?at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
?? ?at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
?? ?at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
?? ?at java.lang.Thread.run(Thread.java:748)


```


author: Norman Cates
body: I also am trying to search for a URL in our Confluence site.

We are migrating a Twiki to Confluence.

The Twiki URLs are of the form:

<https://twiki.company.com>

I have tried this search which works:

/.\*twiki.\*/

Which will find those URLS, but also every other instance of Twiki.

This search does not work:

/.\*twiki\\.company.\*/

Which doesn't make sense. I've escaped the full stop.

Any ideas?


author: Russ Baker
body: You guys understand that not being able to find a basic text string in your pages is a pretty major failing of a data repository in this day and age, right? Sure, there are workarounds. Sure, you can use a regex. But critically, when I type a string I know is in there and can't find it, I start asking some very fundamental questions about this product. Strongly recommend you get the search tools up to a point that they meet basic expectations of a search tool. This has been one of my biggest issues with Confluence, and the kind of thing that would lead us to consider alternatives.

comments: author: K.C. Murphy
body: Even Sharepoint has a way to dredge the entire contents and Find and Replace. This is 1980's technology, and it is shocking that it is not possible in this tool.


author: easifyandroid
body: For example if external site url to search is [https://demo.site.com/.....](https://demo.site.com/) . This worked in confluence for me :

***http\*demo\*site\*com\****

Regards,

Ankit

comments: author: GJP
body: This solution works and is simple in application.


author: Amy Russell
body: I can't thank you enough for this solution! This worked great!


author: Norman Cates
body: Does this search still work for anyone?

We are migrating a Twiki to Confluence.

The Twiki URLs are of the form:

[https://twiki.company.com](https://twiki.company.com/)

I have tried this which does not work.

\*twiki\*

There are instances of twiki in the pages being searched.

Any ideas?


author: GJP
body: Try, for example, https\*twiki\*company\*com or any combination of words that make up your url. The more words you use, the more accurate results you will get.


author: Richard Cross
body: Just to extend/expand upon the previous response, take the full URL you want to search and substitute any special characters with an asterisk (\*).

So

```
https://mysite/content/fruit.html?search=apples
```

would become:

```
https*mysite*content*fruit*html*search*apples
```

**Pro Tip:** Go directly to the advanced search page (at \<confluence site\>/dosearchsite.action) and put some restrictions on the search before running.


author: Natasha Noble-Hunter
body: Thanks for this [@Richard Cross](/t5/user/viewprofilepage/user-id/664850)

I tried doing this but it's not working. I have pages I know are 100% using my url but are not being returned in the search. It is returning only 14 results and I know there are **at least** 20, so I cannot rely on the results at all. I wonder if it excludes Space home pages in the results?

I am looking for any instance where a page includes part of the old microsoft stream link (<https://web.microsoftstream.com/video/>....)

I understand that \* (asterisk) is required at the end as a wildcard because each URL will have a different path after 'video/'

I have tried regex search and your method with no real luck. Any ideas?

https\*web\*microsoftstream\*com\*video\* - (14 results)

https\*web\*microsoftstream\*com\*video - (1 result)

"https\*web\*microsoftstream\*com\*video\*" - (no results)

"[https://web.microsoftstream.com/video\*](https://web.microsoftstream.com/video*)" - (14 results)

"<https://web.microsoftstream.com/video/>" - (14 results)

"https\*web\*microsoftstream\*com\*video/\*" - (no results)

<https://web.microsoftstream.com/video/> - (any page with 'video')

https\*web\*microsoftstream\*com\*video/\* - (any page with 'web', 'video' and 'stream')

/.\*[https://web.microsoftstream.com/video.\*/](https://web.microsoftstream.com/video.*/) - (any page with word 'video' and 'stream' in)

/.\*[https://web\\](https://web\).microsoftstream\\.com/video.\*/ - (any page with the word 'video' in)

/.\*[https://web\\](https://web\).microsoftstream\\.com/video\*.\*/ - (any page with the word 'video' in)


author: Andr? de Carvalho
body: Its just a **show stopper** : to have a wiki where You can not find all occurrences of links You want to update. How are You supposed to keep links updated in Your system?

Again this is just a result of the childish "ephemeral chat" perspective and not a serious, professional system to produce and maintain knowledge.

The response "We had an existing [feature request](https://jira.atlassian.com/browse/CONFSERVER-27503)to extend the search capabilities, but this has since been closed." is just unacceptable and rude. I know You don't care, don't need to say it in my face...


author: Michi S.
body: **![Export to Word.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/246725i22A3F456D5105525/image-size/large?v=v2&px=999 "Export to Word.jpg")Export to Word** is in my opinion the easiest way to find the links. Important: check both of the url checkboxes on the content tab (s. attached screenshot).

Afterwards, you find all the links by a simple text search in the resulting docx file.


author: Michelle Rau HP
body: If you have access to the Reporting add-on, you can create a report to find all these links. I wrote about doing that here: [https://community.atlassian.com/t5/Confluence-articles/Finding-and-fixing-broken-links-with-Reporting-for-mere-mortals/ba-p/1334589](https://community.atlassian.com/t5/Confluence-articles/Finding-and-fixing-broken-links-with-Reporting-for-mere-mortals/ba-p/1334589?)

comments: author: robert_seeger
body: Ironically, the link to a recipe to fix broken links was broken by some trailing characters ;-)

Searching for it found it <https://community.atlassian.com/t5/Confluence-articles/Finding-and-fixing-broken-links-with-Reporting-for-mere-mortals/ba-p/1334589>


author: Norman Cates
body: Could someone PLEASE expand on how you created a report, what Service Rocket is and how to DO all these things?

This article assumes so many bits of knowledge I have no idea where to start.

What Macros are required? And / or what addons are required?

I am pretty new to Confluence, and landed here because I need to try to find URLs in a site we are migrating.

Links to information is totally fine.


author: robert_seeger
body: Service Rocket is the producer of the Confluence plugin [Reporting for Confluence.](https://marketplace.atlassian.com/apps/186/reporting-for-confluence?hosting=datacenter&tab=pricing)

It is very powerful but not easy to use for a newbie or non-developer - it is basically "programming by macro design" - and quite expensive.

The article shows you all the macros required and how to nest them for this specific use case, but this requires the plugin. The plugin documentation contains plenty of other use cases with "recipes".


author: Norman Cates
body: Thank you.

Since Atlassian search should work to be able to find things like URLs in a trivial manner, I will keep bugging them about actually getting Search to work.

A plugin as described above is far too much overkill for something that should work anyway.


author: Norman Cates
body: As a follow up to this, I found a section in the help for Confluence search that says basically, you can't use an \* or ? at the start of a search term. The search will just fail silently.

Hence my attempts at \*twiki\*company\*com were just failing silently.

[@GJP](/t5/user/viewprofilepage/user-id/2937101) suggested https\*twiki\*company\*com which does indeed work.

But the basic takeaway is that an \* or ? at the start will silently fail with Confluences search implementation.


Tags: search

url