0

我正在尝试搜索以左撇号开头但不包括句号和右撇号的 250 多个字符的字符串;逗号和结束撇号;感叹号和结束撇号;或问号和结束撇号。我正在尝试查找长引号,但不包括短引号(少于 250 个字符)。问题是右引号看起来与所有格撇号相同。(也许美国人用他们的双引号引起了一些注意?)

这是没有排除标点符号的代码。,!?

‘[^’]{230,}

这是我修改后的代码(不起作用):

‘[^.’|,’|?’|!’]{230,}

这样我就可以包含诸如“查尔斯的马”之类的短语,但不包括 250 个字符以下的引号

4

2 回答 2

3
于 2021-05-21T18:36:53.570 回答
0

Thanks. I badly explained what I wanted, but this does what I asked. What I actually needed was a way of finding long quotes which didn't preclude long quotes containing an apostrophe s. This seems to work in the Regex demo, but doesn't in InDesign.

‘.{250,}(?=[.’])(?=[,’])(?=[?’])(?=[!’])

https://regex101.com/r/Um2Ylb/1

There are two long quotes (one with a possessive apostrophe s) and one short quote and it finds both long quotes. But in InDesign it just finds anything preceded by an apostrophe (it ignores the full point, question mark, comma, and exclamation mark). I think this is because it's only looking at a single character in the positive lookbehind. Is there a way of getting it to look for both characters?

于 2021-05-23T15:05:55.270 回答