Regex to match this -


i'm trying capture phpunit output file path , error line condition.

  • i don't want want lines contain whole word exception (can exclude multiple words?).

this output , non-working (obviously:) pattern:

/path/includes/exception.php:7 /path/things-i-care-about/es/somefile.php:132 /path/things-i-care-about/es/somefile.php:121 /path/things-i-care-about/es/somefile.php:54 /path/things-i-care-about/es/somefile.php:60 /path/things-i-care-about/es/somefile.php:41 /path/things-i-care-about/es/somefile.php:47 /path/things-i-care-about/testfile.php:26  pattern: /((?!exception).*.php):(\d.*)/gs 

what tried negating line has "exception" in it, regex didn't quite work.

what doing wrong?

you can try pattern:

^(?:[^e\n]+|\be|\be(?!xception\b))+\.php:\d+$ 

or pattern, if don't need check specific line format:

^(?>[^e\n]++|\be|\be(?!xception\b))+$ 

notice: if need select consecutive lines in 1 block, need remove \n character classes.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -