The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Brant Schroeder
Community Champion
August 24, 2024

@Aditya Jha Welcome to the Atlassian community

Are you trying to remove them via the API?

TAGS
AUG Leaders

Atlassian Community Events