我目前正在使用此REGEX来获取前缀为PRE_的整个单词 \b(PRE_)\S* 这适用于大多数情况,但我想处理特殊字符是单词的一部分时的情况,例如句号,逗号或其他特殊字符。,; - {}()[] 例如,这里的话: PRE_samplewordwithoutdelimiter PRE_sampleword.otherwordsnotincluded; PRE_Sampleword{}...deleted PRE_complexword()a.;.is deleted Somewords ahead PRE_sometext() ending in other words Words with bracket [PRE_brackettext] are deleted PRE_sampleword is spaced out so deleted sampleword.PRE_deleted; notdeleted.notdeleted.PRE_ 我只希望找到一个分隔词的第一部分。所以我可以删除或替换这个词。因此,在使用“”作为文本替换此场景中的所有PRE_前缀单词的情况下,我会得到: <DELETED> <DELETED>.otherwordsnotincluded; <DELETED>{}...deleted <DELETED>()a.;.is deleted Somewords ahead <DELETED>() ending in other words Words with bracket [<DELETED>] are …
我有一个RTF文件格式如下: Lorem ipsum dolor sit amet, consectetur adipiscing elit.\par Nullam vitae sem porttitor urna pellentesque gravida. Nulla\par consequat purus vel est vehicula porttitor.\par Maecenas pharetra metus in enim sollicitudin sollicitudin.\par Etiam et odio tellus, eget placerat enim. Aliquam sem purus,\par gravida sed feugiat eget, consectetur quis nisl.\par (\ par为简洁而添加) 如您所见,已插入换行符以适合页面的宽度。当我尝试读取iPhone上的文本时出现问题,该文本具有不同的行长度。线条断裂,可读性受阻。 …