0

I have a string input something like this:

[hellothere1241 fellow omg what][how many tiasf sgasgag][gas adgh adh sdgsd gsd][ gsdgsdgsdg sd sdgsdgsgsd ga21451t ][t13g1gsd s]

I need to get all the strings between each [ and ] to an array like that:

hellothere1241 fellow omg what
how many tiasf sgasgag
gas adgh adh sdgsd gsd
gsdgsdgsdg sd sdgsdgsgsd ga21451t
t13g1gsd s

Can anyone give me an example? Thanks in advance!

StuartLC
  • 104,537
  • 17
  • 209
  • 285

1 Answers1

1

You can use the regex mentioned in this answer. The VB.NET equivalent would be

Dim pattern = "\[(.*?)\]"
Dim query = "[hellothere1241 fellow omg what][how many tiasf sgasgag][gas adgh adh sdgsd gsd][ gsdgsdgsdg sd sdgsdgsgsd ga21451t ][t13g1gsd s]"
Dim matches = Regex.Matches(query, pattern)
Community
  • 1
  • 1
keyboardP
  • 68,824
  • 13
  • 156
  • 205