Skip to main content
2 of 2
typo
Adám
  • 31.1k
  • 3
  • 124
  • 287

APL (Dyalog Unicode), 23 bytesSBCS

Full program. Prompts for text and prefix from stdin. Prints list to stdout.

(5⌽'(\w+)\b',⎕)⎕S'\1'⊢⎕

Try it online!

 prompt (for text)

 yield that (separates '\1' from )

()⎕S'\1' PCRE Search and return list of capture group 1 from the following regex:

 prompt (for prefix)

'(\w+)\b', prepend this string (group of word characters followed by a word boundary)

5⌽ rotate the first 5 characters to the end; '\bPREFIX(\w+)'

Adám
  • 31.1k
  • 3
  • 124
  • 287