Commit Graph

25 Commits

Author SHA1 Message Date
Carlo Marcelo Arenas Belón 7db8784296
pcre2grep: correctly handle multiple passes (#35)
* tests: use a explicit filehandle to share in testing -m

The way stdin is shared to all participants of a subshell varies
per shell, and at least the standard /bin/sh in Solaris seem to
create a new copy for each command, defeating the purpose of the
test.

Use instead exec to create a filehandle that could then be used
explicitly in the test to confirm that the stream is set.

* pcre2grep: correctly handle multiple passes

When the -m option is used, pcre2grep is meant to exit after enough
matches are found but while leaving the stream pinned to the next position
after the last match.

Unfortunately, it wasn't tracking correctly the beginning of the stream
on subsequent passes, and therefore it will fail to use the right seek
value.

Grab the position of the stream at the beginning and while at it, make
sure that the stream passed hasn't been consumed already.
2021-11-09 16:57:48 +00:00
Philip.Hazel 81da2b97e3 pcre2grep update: -m and $x{..}, $o{..} escapes. Also some doc updates. 2020-10-04 16:34:31 +00:00
Philip.Hazel 0d1ab8515f Fix pcre2grep -o bug when ovector overflows; add option to adjust the limit;
raise the default limit; give error if -o requests an uncaptured parens.
2019-06-15 15:51:07 +00:00
Philip.Hazel e75410a5d8 More typos and changes to "Kibibytes" for "Kilobytes". 2018-06-18 14:03:33 +00:00
Philip.Hazel 04919e9d03 Add support to pcre2grep for binary zeros in -f files. 2018-02-24 17:09:19 +00:00
Philip.Hazel 911d43cd1e Fix \K issues in pcre2grep. 2017-12-26 15:10:04 +00:00
Philip.Hazel 76814d92c7 Fix multiple multiline matching issues in pcre2grep. 2017-11-13 16:52:39 +00:00
Philip.Hazel 76a57bd839 Convert pcre2grep to use new pcre2_compile() options, thereby fixing two minor
(?) bugs.
2017-06-17 11:32:06 +00:00
Philip.Hazel 0cb5a91218 Update test output. 2017-04-12 13:26:23 +00:00
Philip.Hazel 88abc14e42 Jason Hood's pcre2grep patches (modified a bit) to add --output to pcre2grep,
and also an inbuilt callout echo.
2017-04-06 18:02:40 +00:00
Philip.Hazel 0299bba9d9 Fix previously broken fix for pcre2grep with -Mo matching strings that cross
line boundaries.
2017-02-10 17:39:29 +00:00
Philip.Hazel 396a7c7d29 Upgrade pcre2grep for Windows courtesy of Jason Hood. 2016-12-31 17:40:45 +00:00
Philip.Hazel 25dbe146bd Very minor tidy to pcre2grep, plus fix typos in comments. 2016-12-29 16:29:05 +00:00
Philip.Hazel 1828179ef9 Add -t to pcre2grep. 2016-10-16 16:48:14 +00:00
Philip.Hazel bf6f0bb335 Implement buffer expansion in pcre2grep. 2016-10-11 16:40:09 +00:00
Philip.Hazel b002f44061 Fix bad interaction between -o and -M in pcre2grep. 2016-06-17 17:37:26 +00:00
Philip.Hazel ddcedf0338 pcre2grep: fix \r\r\n problem for Windows, and give buffer size in error
message.
2016-04-01 09:15:38 +00:00
Philip.Hazel 537f8b1a3d Make -q override -l and -q in pcre2grep for compatibility with other greps. 2015-08-05 17:35:36 +00:00
Philip.Hazel cda8384a95 Fix pcre2grep loop provoked by \K in a lookbehind assertion in a non-anchored
pattern.
2015-04-03 11:14:19 +00:00
Philip.Hazel a398ae3bef Test output needed updating. 2015-02-06 09:29:31 +00:00
Philip.Hazel cb8865d247 Update and improve substring handling and its documentation. 2014-12-14 17:17:06 +00:00
Philip.Hazel f1c6ee730a Code for pcre2_substitute(), and tests. 2014-11-11 10:19:23 +00:00
Philip.Hazel 8aa511a98b Improve test coverage; minor typo in JIT test and other minor buglets fixed. 2014-10-31 12:34:34 +00:00
Philip.Hazel eee8530add API documentation and a lot of little related changes to the code. 2014-09-19 07:43:39 +00:00
Philip.Hazel 7854bf34b3 Implement pcre2grep and its test. 2014-07-15 08:46:12 +00:00