本文由我司收集整编,推荐下载,如有疑问,请与我司联系仅从字符串的开头和结尾删除非字母数字字符仅从字符串的开头和结尾删除非字母数字字符[英]Remove non-alphanumeric characters from start and end of string only I am trying to clean up some data using a helper exe (C#).
我试图使用帮助程序exe(C#)清理一些数据。
I iterate through each string and I want to remove invalid characters from the start and end of the remove the dollar symbols from $$$helloworld$$$.
字符串截取去掉第一位 我遍历每个字符串,我想从字符串的开头和结尾删除无效字符,即从$$$ helloworld $$$中删除美元符号。
This works fine using this regular expression: \W.
使用这个正则表达式可以正常工作:\ W.
However, strings which contain invalid character in the middle should be left hello$$$$world is fine and my regular expression should not match this particular string. 但是,中间包含无效字符的字符串应该保持不变,即hello $$$$ world是正常的,我的正则表达式不应该与此特定字符串匹配。
So in essence, I am trying to figure out the syntax to match invalid characters at the start and the end of of a string, but leave the strings which contain invalid characters in their body.
因此从本质上讲,我试图出在字符串的开头和结尾匹配无效字符的语法,但是留下包含无效字符的字符串。
Than[标签:内容]
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论