powergrep

Regex for nth line in a text file

拜拜、爱过 提交于 2019-12-13 04:49:42
问题 I've been trying to get this regex down and searched alot for answers What I need is to get the nth (4th in this example) line from a text file I got this down atm ^(?<=([^\n]*\n){3})[^\n]*\n But it doesn't seem to work (something about needing fixed length patterns in lookbehind) Is there any way to overcome that obstacle? Can anyone provide a correction\different regex if needed for this problem? Thanks Edit: I'm trying this regex in PowerGrep and it just doesn't work P.S: Is there a way of

Regex find catch blocks without log

╄→尐↘猪︶ㄣ 提交于 2019-12-06 01:10:22
问题 I am using regex with PowerGrep to search through a bunch of files. I am working with java files and my goal is to find all catch blocks that do not contain the word log within the block so that I can add logging. There are alot of files, so going through them manually isn't really feasible. Examples of what should be found catch (Exception e) { //comment# int math = 1 +2 * (3); String email = "email@example.com"; anothermethod.call(); //no logging } and catch(AnotherException e ) {} //no

Regex find catch blocks without log

▼魔方 西西 提交于 2019-12-04 05:49:32
I am using regex with PowerGrep to search through a bunch of files. I am working with java files and my goal is to find all catch blocks that do not contain the word log within the block so that I can add logging. There are alot of files, so going through them manually isn't really feasible. Examples of what should be found catch (Exception e) { //comment# int math = 1 +2 * (3); String email = "email@example.com"; anothermethod.call(); //no logging } and catch(AnotherException e ) {} //no logging Examples of what should NOT be found catch(AnotherException e ) { //some code log.error("Error