简体   繁体   中英

Using jdeps with REGEX

I'm able to get the list of dependencies using jdeps: jdeps myjar.jar works fine.

Tried excluding a particular package in the output: jdeps -f 'java.io' myjar.jar - this excludes the package java.io from the output

Finally, i would like to exclude all packages that starts with the name "java" using regex:

  • jdeps -f 'java' myjar.jar -> didn't work (does not filter 'java' packages)
  • jdeps -f '/java/i' myjar.jar -> didn't work (does not filter 'java' packages)
  • jdeps -f '^java' myjar.jar -> didn't work (does not filter 'java' packages)

Can someone help me to filter all the packages that match a given pattern?

Try Negative Lookahead operator !?

The regex looks like this: ^(?!java) (returning only when line doesn't start with java )

The final code looks like this: jdeps -f '^(?!java)' myjar.jar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM