Hi all. I have a string that I am trying to break into two parts based on a hypen. However, the complication is that there are situations where I don't want the hypen to count. Example:
1: ThisIsSampleText-ThisIsSampleName
2: This - IsSampleText-ThisIsSampleName
In #1, I want two pieces: ThisISSampleText and ThisIsSampleName
In #2, I want two pieces: This - IsSampleText and ThisIsSampleName
There are, of course, variations of this where I could have something like:
This- IsSample...
This -IsSample...
ThisIsSampleText-ThisIs-SampleName...
I basically want to look for the first hypen without any spaces before and/or after and break the string at that point.
I would also like to count the number of hypens in the overall string to help me create error processing around the other possible complications.
Could someone assist with the RegEx or formula that will allow me to do this? Thank you.