I am trying to split a sentence with 32 chars in each group of regex. The sentence is split after the complete word if 32nd character is a letter in the word. When my input is a sentence which has "-" it splits that word too.
This is the regex I am using
(\b.{1,32}\b\W?)
Input string:
Half Bone-in Spiral int with dark Packd Smithfield Half Bone-in Spiral Ham with Glaze Pack
resulting groups:
- Half Bone-in Spiral int with
- dark Packd Smithfield Half Bone-
- in Spiral Ham with Glaze Pack
In above split "Bone-in" is one word but regex splits it considering separate words. How can I modify my regex to treat "-" as one word? In short, I want the split after Bone-in.
Thank You.