In the future, try to provide a reproducible example FAQ: How to do a minimal reproducible example ( reprex ) for beginners. I've tried to make one based on the screenshot but you should do this when posting a question. Here's an example which I think does what you want assuming you've imported the data into R already:
library(tidyverse)
Products <- tibble(
G=c("HS codes: 0105 0106 0207 0407",
"HS codes: 0105",
"HS codes: 0105 0207 0407",
"ICS codes: 67.120.20"
)
)
Products_split <- Products %>%
mutate(
Code_01=str_extract_all(G, "01[0-9]{2}"),
Code_02=str_extract_all(G, "02[0-9]{2}")
)
Products_split
#> # A tibble: 4 x 3
#> G Code_01 Code_02
#> <chr> <list> <list>
#> 1 HS codes: 0105 0106 0207 0407 <chr [2]> <chr [1]>
#> 2 HS codes: 0105 <chr [1]> <chr [0]>
#> 3 HS codes: 0105 0207 0407 <chr [1]> <chr [1]>
#> 4 ICS codes: 67.120.20 <chr [0]> <chr [0]>
Products_split %>%
pull(Code_01)
#> [[1]]
#> [1] "0105" "0106"
#>
#> [[2]]
#> [1] "0105"
#>
#> [[3]]
#> [1] "0105"
#>
#> [[4]]
#> character(0)
Products_split %>%
pull(Code_02)
#> [[1]]
#> [1] "0207"
#>
#> [[2]]
#> character(0)
#>
#> [[3]]
#> [1] "0207"
#>
#> [[4]]
#> character(0)
Created on 2021-02-24 by the reprex package (v1.0.0)