Существует множество пакетов, предлагающих функции na.locf
(NA
Last Observation Carried Forward):
xts
- xts::na.locf
zoo
- zoo::na.locf
imputeTS
- imputeTS::na.locf
spacetime
- spacetime::na.locf
А также другие пакеты, в которых это функция названа по-разному.
Вы можете использовать:
(?<=^24\S{3}).*$
Вот демо: https://regex101.com/r/HqT0RV/1/
Это вы получите ожидаемый результат (т. е. 00:80:a3:bf:72:d45
). Однако это не похоже на действительный MAC-адрес (в конце 5
, похоже, не является частью MAC). В этом случае вы должны использовать что-то вроде этого:
(?<=^24\S{3})(?:[0-9a-f]{2}:){5}[0-9a-f]{2}
Демонстрация: https://regex101.com/r/HqT0RV/2
[1112 ] Разбивка:
(?<= # Start of a positive Lookbehind.
^ # Asserts position at the beginning of the string.
24 # Matches `24` literally.
\S{3} # Matches any three non-whitespace characters.
) # End of the Lookbehind (five characters so far).
(?: # Start of a non-capturing group.
[0-9a-f] # A number between `0` and `9` or a letter between `a` and `f` (at pos. #6).
{2} # Matches the previous character class exactly two times.
: # Matches `:` literally.
) # End of the non-capturing group.
{5} # Matches the previous group exactly five times.
[0-9a-f] # Any number between `0` and `9` or any letter between `a` and `f`.
{2} # Matches the previous character class exactly two times.