- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 02:16 AM
Hi,
I have been searching the community but not actually found the solution. I need to extract the text between the the 2 "|" as shown in the below example:-
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 02:20 AM
Hello @jonathangilbert ,
Try below script
var input = "TICKET ID 924209 | ABNORMAL_ANONYMOUS_IP | JOE BLOGGS";
var parts = input.split("|");
var result = parts.length > 1 ? parts[1].trim() : "";
gs.info("Extracted value: " + result);
and below is the updated script of yours,
var str = 'TICKET ID 924209 | ABNORMAL_ANONYMOUS_IP | JOE BLOGGS';
var split1 = str.split(";");
var cat = parts.length > 1 ? parts[1].trim() : "";
current.u_report_name = cat;
Thanks,
Valmik Patil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 02:30 AM
@jonathangilbert if it worked you can accept my solution as well - we can accept multiple solutions in community now.
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY