I believe you can use $<num> as the substText parameter, e.g. have a
capturing part of your regex and $1 would be the first capture group, $2
would be the second capture group, etc.

On Fri, Jun 23, 2023 at 10:09 AM Jyoti singhal <jyoti2...@gmail.com> wrote:

> Hi Alex,
>
> Apologies from my side. Its working with single quotes now, I was giving
> the wrong syntax,
>
> Wanted to check one thing right now it's extracting this whole line, Is
> there any way to just get this link in email?
> [image: image.png]
>
> On Fri, Jun 23, 2023 at 9:38 PM Alex Earl <slide.o....@gmail.com> wrote:
>
>> Can you share your single quote version? I just want to make sure you are
>> doing what I expect.
>>
>> On Fri, Jun 23, 2023 at 7:16 AM Jyoti singhal <jyoti2...@gmail.com>
>> wrote:
>>
>>> i have tried with Single quotes as well , it takes it as a text and
>>> print the complete line as it is.
>>>
>>> Thanks,
>>> Jyoti
>>>
>>> On Fri, 23 Jun, 2023, 18:16 Alex Earl, <slide.o....@gmail.com> wrote:
>>>
>>>> When you use double quotes in pipeline, the groovy engine will try and
>>>> interpolate the variables it sees. You should try using single quotes
>>>> around the body value.
>>>>
>>>> On Fri, Jun 23, 2023, 04:13 Jyoti singhal <jyoti2...@gmail.com> wrote:
>>>>
>>>>> Hi All,
>>>>>
>>>>> I am trying to get one line from build logs and sending in email for
>>>>> that i tied to use BUILD_LOG_REGEX in emailext but its throwing me this
>>>>> error
>>>>>
>>>>> *CodCode:*
>>>>> *```*
>>>>> { emailext (
>>>>> mimeType: 'text/html',
>>>>> attachLog: true,
>>>>> subject: "Jenkins Build ${currentBuild.currentResult}: Job ${
>>>>> env.JOB_NAME}",
>>>>> body: "${BUILD_LOG_REGEX, regex="Check out job at", maxMatches=2,
>>>>> showTruncatedLines=false}",
>>>>> to: 'jyoti2xx'
>>>>> *```*
>>>>> *Error:*
>>>>> 6:10:26
>>>>>  org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
>>>>> failed:
>>>>> 16:10:26  WorkflowScript: 38: unexpected token: BUILD_LOG_REGEX @ line
>>>>> 38, column 15.
>>>>> 16:10:26          body: "${BUILD_LOG_REGEX, regex="Check out job at",
>>>>> maxMatches=2, showTruncatedLines=false}",
>>>>> 16:10:26
>>>>>
>>>>>
>>>>> Any idea how to fix this issue?
>>>>>
>>>>> Thanks,
>>>>> Jyoti
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Jenkins Users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to jenkinsci-users+unsubscr...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/jenkinsci-users/b64d7b8d-1595-40bd-8096-f88da3e2e81cn%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/jenkinsci-users/b64d7b8d-1595-40bd-8096-f88da3e2e81cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Jenkins Users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to jenkinsci-users+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVefUjn8GLFfaY%3DBmzyd428bbT08e2R5i%3D1e5_TdRq3A0g%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVefUjn8GLFfaY%3DBmzyd428bbT08e2R5i%3D1e5_TdRq3A0g%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Jenkins Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to jenkinsci-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/jenkinsci-users/CA%2BC7GVyxERm9u9qO0703457Gpj97NfuTbGQZgz3078rx%3Dbs43g%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/jenkinsci-users/CA%2BC7GVyxERm9u9qO0703457Gpj97NfuTbGQZgz3078rx%3Dbs43g%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> --
>> Website: http://earl-of-code.com
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to jenkinsci-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVeOAVMr8QnY-%2B-H2Bp7uivy0FYmiBcCZGWctnLwYk1ofw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVeOAVMr8QnY-%2B-H2Bp7uivy0FYmiBcCZGWctnLwYk1ofw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/CA%2BC7GVwazONoa2YQ5C-x%2BzadEChK9Qz4O%2BsUH7C7r9dyoOa7_g%40mail.gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-users/CA%2BC7GVwazONoa2YQ5C-x%2BzadEChK9Qz4O%2BsUH7C7r9dyoOa7_g%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Website: http://earl-of-code.com

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVcEa4dDoWKiJmMHd77Av5N0ucXLM8a_7jP0LRLy6xaqAg%40mail.gmail.com.

Reply via email to