.net - Regex is removing ellipsis character -


i not able read regex , have inherited code i'm trying interpret. have 2 questions.

first, can please explain pieces of regex pattern doing?

second, have issue ellipsis character being replaced space code , retain ellipsis. needs change in statement retain ellipsis?

dim test string = "test...test" 'this 3 dots , not ellipsis, example dim notgoodcharacters string = "[^\w\,<>:;~`@#$%^&*()_=+\-{}|[\]\\?/! ""'']" return system.text.regularexpressions.regex.replace(test, notgoodcharacters, " ") 

much thanks.

this replacing character not in set:

\w\,<>:;~@#$%^`&*()_=+-{}|[]\?/! ""''  

with space. time see [^...] regex matching character not 1 of characters between [^ , ]. \w matches word character, \, matches comma, \\ matches slash. guess ellipse none of characters makes sense stripped out.

update:

after @alan's comment noticed few more should explained. \- matches dash, \] matches closing square bracket.

if want exclude ellipse try changing regex this:

dim notgoodcharacters string = "[^\w\,<>:;~`@#$%^&*()_=+\-{}|[\]\\?/! ""''\x85]" 

the \x85 matches ascii code horizontal ellipsis.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -