Forums

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

Can't get replaceAll to match whenever tokens (^,\n,\b,$,etc) are used

Bobson Dugnutt
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!
February 5, 2024

Jira Smart Values - Text fields

Hoping someone may be able to help with this. I have been racking my brain with Atlassian's "rules" for how it was decided that replaceAll would be implemented.

Most of this seems to have been thrown right out the window.

Unfortunately, this didn't help me either.

 

Example follows

 

Issue Description:

Item

Notitem

Not an item
item

item

item
item
item

 

Intention: Remove all instances of "item" on a line by itself. The normal regular expression that would match what I want to remove is simply: ^item$

Failed attempts:

{{issue.description.replaceAll("(\nitem\b)","")}}
{{issue.description.replaceAll("(^item$)","")}}
{{issue.description.replaceAll("(\nitem$)","")}}
{{issue.description.replaceAll("(^item)","")}}

 

regex101 

1 answer

1 accepted

0 votes
Answer accepted
Bobson Dugnutt
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!
September 24, 2024

The valid string to accomplish my goal was:

{{issue.description.replaceAll("(?m)^item$\n?", "")}}

 Thank you me

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events