Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Created·2021-06-05 20:27
Flavor·Java

"
(?<ApWord>((\w+)(')(\w+)))|(?<HyWord>((\w+)(-)(\w+)))|(?<Rest>\w+)
"
gm
Open regex in editor

Description

Simple little regex to pull words out of a sentence. Obviously \w+ exists, but this accounts for a few corner cases that would normally be missed. Things like let's or ten-four good-buddy.

Submitted by Tony B.