STX
andETX
:somestring
in each of the sticking with:s.
between the collection to eliminate additional whitespace. By doing therefore you simply no longer require to make use ofTrim
as I recommended in my earlier reaction below.'STX(.+?)ETX'
, must end up being escaped to avoid it from getting construed as a personality class in regex. The closing group,
want not end up being escaped. The(.+?)
is a capturing team (expected to the parentheses) and matches at least one character in a non-greedy style (via the?
). By getting non-greedy it prevents the regex motor from greedily complementing multiple incidences and articles till the final 'ETX' prevalence. Get rid of the?
and you'll observe what I mean in yourstr4
instance. Since your last example offers multiple incidences you can use the Fits method.Trim
to trim any extra areas (michael.Groups1.Value.Cut
). It's possible to attain in the pattern but complicates it unnecessarily. Use the overburden that allowsRegexOptions.IgnoreCase
if you require to disregard the situation of the 'STX' and 'ETX' text message (if they aren't usually in uppercase form).CRLF
is usually carriage return line feed, but what about the others? What willSOH
,GS
, andSTX
entail?SOH
will beBegin Of Header
STX
is usuallyStart of teXt
GS
is definitelyGroup Seperator