Regular Expressions 101

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
(?<=\G(?!^)|\@apply) ([^\s\;]*|[\p{P}]*)
/
gm

Description

Or any other particular case where given any line that starts with the pattern "@apply" (or any other line heading) and it substitutes any word (list of characters without spaces), with or without puntuation in them, and it adds a custom prefix to all the words in that line but the line heading.

Submitted by @drakopablo.dev - a year ago