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.
subject: Need to count leading tabs (\t ) for a String