Hello,
I want to extract a user out of the issue description. The issue description might look like this:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
User: doejo
What I would like to extract is "doejo"
What I tried:
- {{issue.description.match("User:\s{1}\w{1,}").split(" ").get(1)}}
- {{issue.description.match("User:\s{1}\w+").split(" ").get(1)}}
- {{issue.description.match("User: \w{1,}").split(" ").get(1)}}
- {{issue.description.match("User: \w+").split(" ").get(1)}}
- {{issue.description.match("(?<=User:\s{1})\w{1,}")}}
- {{issue.description.match("(?<=User:\s{1})\w+")}}
- {{issue.description.match("(?<=User: )\w{1,}")}}
- {{issue.description.match("(?<=User:)\w+")}}
Nothing worked so far. Does someone know how I can make it work?
Welcome to the community!
You might want to try this:
{{issue.description.match(".*User:\s?(.*)")}}
With the assumption that "User: doejo" is always on a new line and show only once in your description.
That worked, thank you very much. If I understand correctly, Jira always returns the first capture group, is that correct? If so is that documented somewhere? I used this documentation as well as other sources but I don't recall it being mentioned anywhere.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is correct, it only return the first captured group.
It says so in the documentation you mentioned, maybe you overlooked it:
> Performs a regular expression search and returns the first (and only one) matching regular expression group.
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.