c# - regex to match string not starting and/or ending with spaces but allowing inbetween spaces -



c# - regex to match string not starting and/or ending with spaces but allowing inbetween spaces -

i need regex not match strings starting and/or ending space(s) matching in between spaces. i'm not expert on regex.

i can utilize 2 regexes if needed.

note: using . showing space in examples.

match false for

.text. ..text text.. ..te.xt..

match true for

text te..xt

i came this. matches starting spaces.

^(?!\s+).*$

you can utilize \s character class ^ , $ anchors.

^\s(.*\s)?$

the optional .*\s grouping needed match single non-space character.

c# regex

Comments

Popular posts from this blog

javascript - mongodb won't find my schema method in nested container -

r - url in CRAN extension manual -

asp.net - .NET Control.ID property inconsistency -