How to use match function to extract value


#1

Hi

I want to extract ‘‘invoice’’ alone from subject: XMLReader ERROR-invoice
I used Label before:“XMLReader ERROR-” and Label After, but getting empty result
“(?<=” + labelBefore + “)(.*?)(?=” + labelAfter + “)”
Can someone help me.


#2

@NagaSujitha Everytime invoice will be in the same format are different can you provide more example so it will be easy to provide solution for you


#3

I want to extract value from Subject mail. Format will be same only
eg: i have mentioned below 3 sample mails , in that i need only value after ‘ERROR-’ like invoice,customerParty or salesorder So that based on extracted values i can check service status.

  1. XMLReader ERROR-invoice
    2)XMLReader ERROR-customerParty
  2. XMLReader ERROR-salesorder

#4

@NagaSujitha

Assign v1 = “XMLReader ERROR-invoice”

Assign v1 = v1.Split("-".ToCharArray)(1)


#5

Thank you Indra, It worked


#6

Can someone help me to extract only ‘UnexpectedCountMuleServiceActive’ from below String,
Event Code: UnexpectedCountMuleServiceActive

I used
writefile.Substring(writefile.IndexOf(“Event Code”)+12,45).Split(“x”.ToCharArray)(0)