i have text something like this.
@@MMIVLoader@[email protected]@BCM_7400S_LE@Product@Aug 21 2009@
@@MMIVLib@[email protected]@BCM_7400S_LE@Product@Aug 21 2009@
@@HuaweFGDLDrv@[email protected]@7324@PRODUCT@Aug 20 2009@
@@ProtectVer@[email protected] @BCM_SDE5.03@PRODUCT@Aug 4 2009 06:56:19@
@@KernelSw@[email protected]@BCM-7454@PRODUCT@ Dec 19 2007@
@@ReceiverSw@[email protected]@HWBC01ZS@PRODUCT@May 3 2010@
i want the out put in an array like
MMIVLoader 4.1.2
MMIVLib 4.1.2
HuaweFGDLDrv 01.00.09
ProtectVer 127.8.1
KernelSw 0.0.1
ReceiverSw E.5.6.001
Can any one suggest me how to do this in c# using regular expression or is there a any sophisticated way to do this
thanks in advance
This is easy, you can just split by @ (removing the empty items) and pull the first and third items.
var list = myString.Split(new String[] {Environment.NewLine},
StringSplitOptions.RemoveEmptyEntries)
.Select(item => item.Split(new char[] {'@'},
StringSplitOptions.RemoveEmptyEntries))
.Where(a => a.Length > 2)
.Select(a => new { Item = a[0], Version = a[2] }).ToArray();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With