I’m currently trying to split a string in C# (latest .NET and Visual Studio 2008), in order to retrieve everything that’s inside square brackets and discard the remaining text.
E.g.: ‘H1-receptor antagonist [HSA:3269] [PATH:hsa04080(3269)]’
In this case, I’m interested in getting ‘HSA:3269‘ and ‘PATH:hsa04080(3269)‘ into an array of strings.
How can this be achieved?
Splitwon’t help you here; you need to use regular expressions:Yields your results.