regexsumologic

Regex match for first occurrence


I want start my starts with "["(square bracket). After that I need to find constant string which is "FIELDS THROWING ERROR =>"(constant string), the string will occur after some lines in string. Next, I need to take one word(the word will be dynamic) after constant string then I have to stop after successfully matches the pattern.

sample string: 

------------------------------------------------
Start Method SYNC DATA :: xxx : 5/19/2022 11:09:28 PM : Total Sync Time : 0.00
----------------------------------------------
[xxx][xxx] Upsert Failed : 
     RECORD NUMBER => ABC:000000
     ERROR MESSAGE => There's a problem with this country, even though it may appear correct. Please select a country/territory from the list of valid countries.: Bilcntry
     FIELDS THROWING ERROR => Bilcntry
[xxx][xxx] Upsert Failed : 
    RECORD NUMBER => ABC:000000
    ERROR MESSAGE => There's a problem with this country, even though it may appear correct. Please select a country/territory from the list of valid countries.: Bilcntry
    FIELDS THROWING ERROR => Bilcntry
[xxx][xxx] Upsert Failed : 
    RECORD NUMBER => ABC:000000
    ERROR MESSAGE => There's a problem with this country, even though it may appear correct. Please select a country/territory from the list of valid countries.: Bilcntry
    FIELDS THROWING ERROR => Bilcntry
[xxx][xxx] Upsert Failed : 
    RECORD NUMBER => ABC:000000
    ERROR MESSAGE => There's a problem with this country, even though it may appear correct. Please select a country/territory from the list of valid countries.: Bilcntry
    FIELDS THROWING ERROR => Bilcntry

Desire Output:

[xxx][xxx] Upsert Failed : 
     RECORD NUMBER => ABC:000000
     ERROR MESSAGE => There's a problem with this country, even though it may appear correct. Please select a country/territory from the list of valid countries.: Bilcntry
     FIELDS THROWING ERROR => Bilcntry

Can anyone help me?

Thanks


Solution

  • ^\[.*([A-Z\s]*=>[ A-Za-z0-9\:\[\]\-\_\,\.\?\'\/\“\”\"\(\)\;\!\@\#\$\%\^\&\*\{\}\|\\\+]*)*
    

    It will work after matches specific word after some lines. I attached output image below. Thanks. enter image description here