gpt4 book ai didi

java - 匹配引号内至少有 1 个大写字符的字符串

转载 作者:行者123 更新时间:2023-11-30 08:08:39 25 4
gpt4 key购买 nike

我的 java 文件中有一些字符串行,并尝试进行 Eclipse Regex 搜索,但它不起作用。我想突出显示 RequestParam(value = 后字符串中包含大写字符的行所以从下面 3 行开始,只有中间一行应该匹配 ie RequestParam(value = "someNumber") 其中包含大写“N”。

public Response searchA(@RequestParam(value = "_s", required = true) String searchExpression,
public Response getNumber(@RequestParam(value = "someNumber", required = true) String agencyNumber,
public Response getStuff(@PathVariable("id") String asnId, @RequestParam(value = "customerid") String customerId,

我形成了一个正则表达式,它似乎适用于 regex101,但不适用于 Eclipse。 https://regex101.com/r/vV8uQ3/16

最佳答案

这应该适用于 Eclipse 搜索:

RequestParam *\( *value *= *"[^"\nA-Z]*[A-Z][^"\n]*"

RegEx Demo

确保在 Eclipse 搜索中选中区分大小写正则表达式复选框。

关于java - 匹配引号内至少有 1 个大写字符的字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30719803/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com