How to find all links which content the static port number ?

Andy tran huynh June 19, 2024

Hello All,

I am working on gathering all links which content the port number in all pages in my product spaces.

Example: http://abc.com:1234

Due to the space was contributing by many people and static ports were there, I could not ask one by one. Are there any way to search exactly and quickly?

Thank for your help.

2 answers

1 accepted

2 votes
Answer accepted
Barbara Szczesniak
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.
June 20, 2024

@Andy tran huynh You might try to do an Advanced Search with wildcards—maybe something like:

"http*:1234"

The following pages might help you:

Andy tran huynh July 23, 2024

Thanks @Barbara Szczesniak  in case i dont know which port number after http*:xxxx can you suggest me some hints ?

 

Andy tran huynh July 23, 2024

I tried this and it works as well! 

Example: http://?:?

Like Barbara Szczesniak likes this
0 votes
Andrii Maliuta
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.
June 20, 2024

Hello @Andy tran huynh !

I would think of

Using the Script Runner

https://marketplace.atlassian.com/apps/1215215/scriptrunner-for-confluence?hosting=cloud&tab=overview

import com.atlassian.confluence.pages.Page
import com.atlassian.confluence.pages.PageManager
import com.atlassian.sal.api.component.ComponentLocator

import java.util.regex.Matcher
import java.util.regex.Pattern


def pageManager = ComponentLocator.getComponent(PageManager.class)

long ROOT_PAGE = 1234567L;

String linkPattern = "(<a href=\"https://aaa:d{4}.+?</a>)";

Page parentPage = pageManager.getPage(ROOT_PAGE);

List<Page> pages = parentPage.getDescendants();

for (Page page : pages) {

Pattern regex = Pattern.compile(linkPattern);

Matcher matcher = regex.matcher(page.getBodyAsString());

while (matcher.find()) {

String linksName = matcher.group(0);

log.warn "Page title | " + page.getTitle() + "| Link to Page |" + page.getUrlPath() + " |Links| " + linksName + "\n";
}
}

 

Confluence REST API

https://developer.atlassian.com/cloud/confluence/rest/v2/intro/#auth

 

Andy tran huynh July 23, 2024

Hi @Barbara Szczesniak  this one is too complicated with me, but let me try that.

Thank you

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events