I want to remove nested macros from data center using regex

Aditya Jha
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 27, 2024

Hi,

I have got more then 3000 pages of different macros, what i need to know is how we can delete the nested macros from pages making its content as it is, we only want to remove tags from it .

currently we are using either this 

pattern = fr'<ac:structured-macro\s+ac:name="{macro_name}"[^>]*>(.*?)</ac:structured-macro>|{macro_name}_\w*'

or 

this pattern

pattern = fr'<ac:structured-macro\s+ac:name="{macro_name}"[^>]*>(.*?)</ac:structured-macro>|{macro_name}_\w*' 2 updated_content = re.sub(pattern, r'\1', current_content, flags=re.DOTALL)

but for few pages this is getting helpful but not for all pages, is there any specific regex which will work if the macros are in nested format

can you please help with the nested macro removal using regex irrespective of what format they ?

1 answer

0 votes
Brant Schroeder
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 24, 2024

@Aditya Jha Welcome to the Atlassian community

Are you trying to remove them via the API?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events