package main
import (
    "regexp"
    "fmt"
)
func main() {
    var re = regexp.MustCompile(`(?m)^( {3})+`)
    var str = `      EMPTY_CNT :
      for i in 0 to C_DESCRIPTOR_NUM - 1 loop
         if r.descriptor_array(i).descriptor_state = S_READ_TO_DUMP then
            v.dump_in_progress_cnt := v.dump_in_progress_cnt + 1;
         end if;
      end loop;  -- i
entity descriptor_manager is
   port (
      i_clk                      : in  std_logic;
      i_rst                      : in  std_logic;
      i_desc_mngr                : in  t_i_desc_mngr;
      o_desc_mngr                : out t_o_desc_mngr;
      -- c/s registers
      cr_descriptor_select       : in  std_logic_vector(31 downto 0);
      cr_descriptor_data         : out std_logic_vector(31 downto 0);
      fsm_descriptor_ctrl_status : out std_logic_vector(31 downto 0);
      fsm_event_handler_status   : out std_logic_vector(31 downto 0)
      );
end entity descriptor_manager;`
    
    for i, match := range re.FindAllString(str, -1) {
        fmt.Println(match, "found at index", i)
    }
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Golang, please visit: https://golang.org/pkg/regexp/