One way to do it would be to use strings.Split to split at every "]", and
then drop the leading "[" from each field. Are the fields themselves
guaranteed not to contain "]", or is there some escaping mechanism that
allows them, in which case things get more complex?

You could also just drop the leading and trailing "[", "]" from each record
and split on "][".

On Tue, Jul 5, 2016 at 8:17 PM Freeman Fridie <ffridi...@gmail.com> wrote:

> I have a data file with records in the following format:
>
> [field 1][field 2][field 3][field 4]...
>
> I need to be able to split the record into fields using  [ ] as the
> delimeter.   I assume I need to use regex, but I'm unsure how to proceed.
>
> thanks,
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to