Skip to main content
edited tags; edited tags
Link
Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k
Source Link
SuTron
  • 1.8k
  • 1
  • 11
  • 21

How to extract an association with similar keys from another association?

Considering we have an association like:

asc1 =  <|"a.s.r"->1, "a.s.r345" -> 45, "asc" -> "cas", "qwrs" -> 78, "a.s.r[4]/vu" -> 4, "es" -> 74|>

How to extract an asc2 to include only the pairs where key starts with "a.s.r", as the following:

asc2 = <|"a.s.r"->1, "a.s.r345" -> 45, "a.s.r[4]/vu" -> 4|>

Thank you!