英文:
Issue with Regex characters to modify a string
问题
以下是您要翻译的内容:
新手来到Stack Overflow。
尝试解决正则表达式以修改以下内容的问题:
原始字符串:
753108944)))","0"
"MULTIPOLYGON (((-7.7885889
期望的字符串:
753108944),(-7.7885889
我需要从字符串中删除 ))","0" & vbCrLf & "MULTIPOLYGON ((,但成功率非常低,我认为是因为其中包含了句点(.)。
已尝试许多正则表达式替换配置以及标准字符串操作方法,但均未成功。
英文:
New to Stack Overflow.
Having issues trying to resolve Regex expression to modify the below:
Original string:
753108944)))","0"
"MULTIPOLYGON (((-7.7885889
Desired string:
753108944),(-7.7885889
I need to remove the ))","0" & vbCrLf & "MULTIPOLYGON (( from the string and having a extremely poor success rate, and I think its due to the . (period) being in there.
Have tried many regex replace configurations as well as standard string manipulation methods with no success.
答案1
得分: 0
Replace会执行你在问题中描述的操作:
Dim originalString As String = "753108944)))","""0""" & vbCrLf & """MULTIPOLYGON (((-7.7885889"""
Dim processedString As String = originalString.Replace("))","""0""" & vbCrLf & """MULTIPOLYGON ((")
英文:
Replace will do what you are describing in your question:
Dim originalString As String = "753108944)))"",""0""" & vbCrLf & """MULTIPOLYGON (((-7.7885889"""
Dim processedString As String = originalString.Replace("))"",""0""" & vbCrLf & """MULTIPOLYGON ((", ",")
答案2
得分: 0
替换以下模式,使用 ")(".
(?s)\){3}.+\({3}
输出
753108944),(-7.7885889
英文:
Find and replace the following pattern, with "),(".
(?s)\){3}.+\({3}
Output
753108944),(-7.7885889
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论