javaregexeclipse

match string inside quotes having at-least 1 uppercase char


i have some string lines in my java files and trying to do an Eclipse Regex search but its not working. i want to highlight lines which have an Uppercase character in the string after RequestParam(value = so from below 3 lines, only middle one should match ie RequestParam(value = "someNumber") which has uppercase 'N' in it.

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, 

i formed a regex expression and it seems to work on regex101 but not in eclipse. https://regex101.com/r/vV8uQ3/16


Solution

  • This should work in Eclipse search:

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

    RegEx Demo

    Make sure case sensitive and regex checkboxes are checked in Eclipse search.