Extract value from the text

Vinay49
Tera Expert

Hello Team,

 

I am looking for the help to extract RITM number from the below text. Here date & RITM number will may changes as per the created date .


Text is --- "[01-12-2023 RITM#10273187] Company created"



Thanks in advance
Vinay

1 ACCEPTED SOLUTION

Hi @Vinay49 ,

 

Try updated code

 

var a = '[01-12-2023 RITM#10273187] Company created';
a = a.split(']');
var b = a[0].split(' ');
b = b[1];
gs.info(b);

 

DanishBhairag2_0-1701936865686.png

 

 

Thanks,

Danish

 

 

 

View solution in original post

10 REPLIES 10

Akshata T
Tera Guru

@Vinay49  you can also use the below code:

 

var text = '[01-12-2023 RITM#10273187] Company created';
var t1 = text.slice(0,-16);
var t2 = t1.slice(1,-15);
gs.info("t2 "+t2);
var t3 = t1.slice(11,-1);
var t4 = t3.split('#');
var t5 = t4[0] + t4[1];
gs.info("t5" + t5);