开发者

findstr regular expression missmatch

开发者 https://www.devze.com 2023-03-06 07:42 出处:网络
If I run this CLI command: pdftotext -l 10 file.pdf - | findstr /i /r \"isbn[0-9 xX\\-]*\" I don\'t get a match.

If I run this CLI command:

pdftotext -l 10 file.pdf - | findstr /i /r "isbn[0-9 xX\-]*"

I don't get a match.

If I output xpdf's pdftotext result to text file:

pdftotext -l 10 file.pdf file.txt

then parse this file in Kiki for example with the same pattern:

开发者_开发知识库
isbn[0-9 xX\-]*

I get expected results.

What could be wrong here?

PS stdout from pdftotext is read correctly by findstr


Have you tried some sample inputs with echo isbn1-23-4 | findstr or similar?

To me it seems that Windows findstr doesn't understand the bracket [0-9 xX\-]. However, it seems that echo isbn1-X23-4x | findstr /i /r "isbn[0123456789-xX]*" works, so you might have some success with

pdftotext -l 10 file.pdf - | findstr /i /r "isbn[0123456789-xX]*"
0

精彩评论

暂无评论...
验证码 换一张
取 消