Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Created·2017-09-14 15:24
Flavor·PCRE (Legacy)

/
(?<!\s)(\s\S+?)(?:\r\n?|\n|\z)
/
g
Open regex in editor

Description

Looks for and captures the last single space and the last word in a line of text that is terminated by \r\n, \n or anchored to the back.

Submitted by James Dafferner