.net - Regex to match string up to two consecutive spaces -
i'm using .net experiment regex's.
i'm struggling compose regex capture segment in string ends 2 spaces. example
this test start of next bit
how can capture first portion of above string this test
, knowing 2 segments split 2 spaces (\s
in regex world)?
i've tried stuff like:
this test[^\s{2}]
but that's getting me nowhere.
a more standard regex 1 have be:
this.*?(?=\s{2})
it matches character .*?
until encounters first double \s
(by way, \s
doesn't mean 'space', means whitespace, including newlines, carriage returns, formfeeds, tabs).
or seek little different; match long single 'spaces':
this(?:\s\s+)*
then again, it's simpler split on double space.
.net regex
No comments:
Post a Comment