Hi, in my automation I have a string that ends with the string ": CHGnnnnnn" where n is any digit.
I want to remove the " : CHGnnnnnn" part from the string so I am left with the root e.g. "iantest99 : CHG000123" becomes "iantest99".
I have tried
{{varSource.remove(" : CHG[0-9][0-9][0-9][0-9][0-9][0-9]")}} and other variations on the regex, but I can't get it to work. Any ideas ?
I've achieved what I want using replaceall and replacing with an empty string
{{varSource.replaceAll("CHG[0-9]*$","")}} did the trick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jira's automation capabilities are significantly enhanced by incorporating string manipulation using regular expressions (regex). Regex allows users to define patterns for identifying and extracting specific data from text fields within Jira issues. This can be particularly useful for tasks such as formatting text, extracting key information, or validating input. For example, you can automate the extraction of ticket numbers from comments, format issue summaries to meet naming conventions, or ensure that custom field inputs match a specified pattern. By leveraging regex in Jira automation, users can streamline workflows, reduce manual data entry errors, and ensure consistency across projects, ultimately boosting productivity and efficiency within the platform.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Rees_ Ian
If i want understand correctly , you want to remove : ": CHGnnnnnn" from your field "iantest99 : CHG000123" to get "iantest99"
Can you try with this smart value
{{issue.customfield.substringBefore(" : CHGnnnnnn")}}
Hope this can help :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
replace customefield by the name of your field
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Correction
{{issue.customfield.substringBefore(" : CHG")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.