Is there a way to set regex to change "word" with "phrase" but not if "*word*" is there?
I mean, can we change the 'word' only if it is not part of a bigger word?
I want to bold a word so looking for "Expected" to change into "*Expected*" but I don't want to change if the word is already bolded.
Thanks for whoever answers
Hi @Hadas Using following regex you can validate the letter between asterisk *letter* or not. If *vikrant* is written then it's true otherwise it's false.
Regex code :- \*.*?\*(?!\.\S)
You can test the code here :- https://regex101.com/
Let me know, if this regex not working as per your expectation.
Thanks
V.Y
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.
But still I'd need regex there right?
The problem is I don't know how to replace a string if it is does not part of a bigger pattern.
How would you replace the following text in the issue description?
expected: bla bla and Exptected: bla bla
with
Exptected: bla bla and Exptected: bla bla
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Hadas I am not sure how to validate bold letter using Project automation or Scriptrunner for cloud. I think Regex not work in your scenario. In this smart values need to create. Let me add Project automation expert in our chat.
@Bill Sheboy Can you please us in validating and updating plain letter into Bold letter.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Some more information:
Trying with Jira automation worked if the word "Expected" appears only once but gave weird results if it appears twice or more so I gave it up.
I use ScriptRunner to get the 'description' field text.
and then replaced "Expected" with "*Expected*". The problem it will also replace if "*Expected*" exists and make it "**Expected**" so I want to exclude "*Expected*"
I can work it around with first replacing "*Expected*" with "Expected" but I thought maybe there is a better way to exclude from within the regex expressions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Using Regex try to validate if it's *expected* or only expected is present in desc. If *expected* then no action else change to bold.
In scriptrunner you are changing html description into text right ?
You can do the same in project automation convert html desc to text then validate using regex.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But doing so will result in nothing in case both strings exists right? So the non bolded 'expected' would not change also.
Yes I the 'description' comes as text rather than html. I did not did this on purpose. This is how the get call works I guess.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Hadas I am not sure how to get description field value in scriptrunner for jira cloud. If it's an api call then result in json right ? In Json for bold result comes in this format :-
You can check if contains expected under b":[] then don't make it bold.
b": [
"bold",
"hold"]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Hadas and @Vikrant Yadav
For automation text replacement, you noted the case of "*Expected*" exists and the search/replace makes it "**Expected**"
In my experience...I find some things in the Java Pattern specification for regular expressions are not supported in the automation rule implementation. So a work-around for the doubling to "**" is to first use a regular expression search/replace, and then chain to use the plain text replace to remove the extra asterisks (or another regular expression).
Kind regards,
Bill
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.