How to save the .obj file with connectivty regions included as groups?

Is there a way to save regions data as groups in .obj file after running connectivity filter.

For example, I would like .obj file to looks like this if possible:

g region0
v -0.001809 -0.000717 -0.000283
v -0.001816 -0.000713 -0.000300
v -0.001825 -0.000714 -0.000299
v -0.001819 -0.000717 -0.000282
....
f 10902 10382 10899
f 10383 10382 10902
f 10383 9874 10382
g region1
v -0.001809 -0.000717 -0.000283
v -0.001816 -0.000713 -0.000300
v -0.001825 -0.000714 -0.000299
v -0.001819 -0.000717 -0.000282
....
f 10902 10382 10899
f 10383 10382 10902
f 10383 9874 10382

Thanks,