It would be pretty easy to write some plain ordinary code which examined the characters of the string one at a time, wouldn't it? So how long would you expect it to take you? Could you do it in a minute? 5 minutes?
Okay, now how long is it going to take you to get a working regex? If that's a working regex that you have there then use it. That would be faster than spending the time to write the plain ordinary code. On the other hand if it isn't, and you maybe aren't very good at regex, then it would probably take you longer to get a working regex than to write the plain ordinary code.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Need to count leading tabs (\t ) for a String