本文介绍了正则表达式:如何处理转义字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! Hall?chen! 我需要一些帮助来找到一个字符串中的匹配项,这些字符串有一些 个字符,这些字符被标记为已转义(在单独的 指数列表)。 Escaped意味着它们不能成为任何匹配项的一部分。 我目前的方法是在子串中查找与 转义字符的匹配作为子。然而, 然后^和$模式被错误地对待。 (虽然我使用了 startpos和endpos参数,但没有切片。) 另一个想法是拥有一个永远不会的特殊unicode角色 参加比赛。这些文件对于 这样的事情不是很有希望,还是我错过了什么? 还有其他想法吗? Tsch?, Torsten。 - Torsten Bronger,aquisgrana,europa vetus Jabber ID: br*****@jabber.org (见 http://ime.webhop.org 。模式中的Hall?chen!I need some help with finding matches in a string that has somecharacters which are marked as escaped (in a separate list ofindices). Escaped means that they must not be part of any match.My current approach is to look for matches in substrings with theescaped characters as boundaries between the substrings. However,then ^ and $ in the patterns are treated wrongly. (Although I usestartpos and endpos parameters for this and no slicing.)Another idea was to have a special unicode character that nevertakes part in a match. The docs are not very promising regardingsuch a thing, or did I miss something?Any other ideas?Tsch?,Torsten.--Torsten Bronger, aquisgrana, europa vetusJabber ID: br*****@jabber.org(See http://ime.webhop.org for ICQ, MSN, etc.)推荐答案被错误地处理。 (虽然我使用了 startpos和endpos参数,但没有切片。) 另一个想法是拥有一个永远不会的特殊unicode角色 参加比赛。这些文件对于 这样的事情不是很有希望,还是我错过了什么? 还有其他想法吗? Tsch?, Torsten。 - Torsten Bronger,aquisgrana,europa vetus Jabber ID: br*****@jabber.org (见 http://ime.webhop.org 。in the patterns are treated wrongly. (Although I usestartpos and endpos parameters for this and no slicing.)Another idea was to have a special unicode character that nevertakes part in a match. The docs are not very promising regardingsuch a thing, or did I miss something?Any other ideas?Tsch?,Torsten.--Torsten Bronger, aquisgrana, europa vetusJabber ID: br*****@jabber.org(See http://ime.webhop.org for ICQ, MSN, etc.) Torsten Bronger写道:Torsten Bronger wrote: Hall?chen! 我需要一些帮助找到一个字符串中的匹配项,该字符串具有一些标记为已转义的 字符(在单独的 索引列表中)。 Escaped意味着它们不能成为任何匹配项的一部分。 我目前的方法是在子串中查找与 转义字符的匹配作为子。但是, 然后^和Hall?chen!I need some help with finding matches in a string that has somecharacters which are marked as escaped (in a separate list ofindices). Escaped means that they must not be part of any match.My current approach is to look for matches in substrings with theescaped characters as boundaries between the substrings. However,then ^ and在模式中被错误地处理。 (虽然我使用了 startpos和endpos参数,但没有切片。) 另一个想法是拥有一个永远不会的特殊unicode角色 参加比赛。这些文件对于 这样的事情不是很有希望,还是我错过了什么? 还有其他想法吗? Tsch?, Torsten。in the patterns are treated wrongly. (Although I usestartpos and endpos parameters for this and no slicing.)Another idea was to have a special unicode character that nevertakes part in a match. The docs are not very promising regardingsuch a thing, or did I miss something?Any other ideas?Tsch?,Torsten. 您应该提供您正在尝试做的事情的例子或者您 可能会得到很多不相关的答案。 JamesYou should probably provide examples of what you are trying to do or youwill likely get a lot of irrelevant answers.James 这篇关于正则表达式:如何处理转义字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-14 22:27