Please help me with the regex

Ankitha4
Tera Contributor

I need to write the regex to extract yeasdtsa i.e present in the InstanceGroup, please help me with that

 

Reason: UsedPercent >= 47 65 85
error - agsfuwn34282.hitchi.net  TableSpace Usage maximum table space growth
Host: agsfuwn34282.hitchi.net
Datasource: TableSpace Usage maximum table space growth
InstanceGroup: yeasdtsa.hitchi.net
Datapoint: UsedPercent

1 ACCEPTED SOLUTION

ShubhamGarg
Kilo Sage

Hello @Ankitha4 ,

 

Regular expression " /InstanceGroup: (\w+)/" should print you the required value.

 

If my response helps you in any way, kindly mark this as Accepted Solution/Helpful and help in closing this thread.

Regards,

Shubham

View solution in original post

3 REPLIES 3

ShubhamGarg
Kilo Sage

Hello @Ankitha4 ,

 

Regular expression " /InstanceGroup: (\w+)/" should print you the required value.

 

If my response helps you in any way, kindly mark this as Accepted Solution/Helpful and help in closing this thread.

Regards,

Shubham

Hi Shubham , thanks for the reply . The regex is working when I tried in regex101 but when I tried this regex to extract the same value in event rule . It is not working . Can you please help me with this issue

Mark Manders
Mega Patron

const regex = /(?<=InstanceGroup:\s)[^.]+/;

const match = text.match(regex);

if (match) { console.log(match[0]); // Output: yeasdtsa

} else {

console.log('No match found');

}


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark