Regex

Extract the first word of each line

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

  • "^\w+" Bonus: extract the last word of each line

    • "\w+(?=\W*$)" (in most cases, depends on line formatting)