Reputation: 1624
Consider the example string below:
"And is it possible to foster reconc-
iliation and peacebuilding?"
I would like to match the the token reconc-iliation.
Something like """(?m)\b[^\s]*\-$"""
matches recon- but """(?m)\b[^\s]*\-$^[^\s]*\b"""
does not match reconc-iliation.
Upvotes: 0
Views: 73
Reputation: 11182
This would work
\b(\S+-[\r\n]+\S+)\b
UPDATE
^
--> matches start of line/ or start of string (depending on using s
switch)
$
--> matches end of line/ or end of string (depending on using s
switch)
\b
--> matches an word boundary
\r
--> Carriage return
\n
--> New line
Only windows uses both \r
and \n
as line separator.
Upvotes: 1