I have a chunk of strings, like:
and so on. So these are phrases bracketed with square brackets, and delimited with spaces.Code:[p1 text1/label1] [p2 text2/label2] [p3 text3/label3] [...
But sometimes there are stray chunks of text that are NOT surrounded by square brackets. For example:
I need to pick up all the phrases, whether bracketed with square-brackets or not... any ideas? To pick up all the phrases, I decided to make it easy for myself by just putting the brackets around everything, using regex. But that didn't work out when I realized I had a regex to bracket un-bracketed phrases every time they appeared once in the beginning, middle or end. But not if one or two appear together. (like the Y and Z chunks above).Code:[p1 text1/label1] [p2 text2/label2] textX/labelX [p3 text3/label3] textY/labelY textZ/labelZ [...]