【问题标题】:invoice2data - Ignoring *Item line* because it doesn't match anythinginvoice2data - 忽略*项目行*,因为它不匹配任何内容
【发布时间】:2021-08-18 13:34:34
【问题描述】:

我正在使用 invoice2data 从发票中提取字段。但是,似乎无法匹配发票项目,我不知道为什么。我的发票如下所示:

这是我的代码:

lines:
  start: Valoarea TVA
  end: Data scadenta
  line: (?P<crt>\d+)[ ]*(?P<name>(?:(?:[a-z0-9A-Z\-\/])+[ ]{1})+)(?:[ ]*)(?P<um>[a-z]*)(?:[ ]*)(?P<quantity>\d+)(?:[ ]*)(?P<price>\d+)(?:[ ]*)(?P<value>\d+)(?:[ ]*)(?P<vat_value>\d+)

有人能指出我为什么会记录以下消息吗?

ignoring * 1                Prestari servicii curierat Locker NextDay            val        1                83.79                              83.79                  15.92* because it doesn't match anything
ignoring * 2                Prestari servicii curierat 24H                       val        1                86.5    

                       86.5                   16.44* because it doesn't match anything

【问题讨论】:

  • 你能用文字代替图片吗?你在“记录的消息”部分中的星号是什么意思,比如ignoring * 1你自己添加的吗?您还可以使用预期匹配更新​​问题吗?
  • ignoring * 1 ... 是我在发票 pdf 上运行 invoice2data 脚本时得到的。我想匹配发票中的产品列表(附上第一张照片),但我目前没有匹配到 'lines': [],

标签: regex invoice


【解决方案1】:

使用此正则表达式管理获取发票产品:

line: (?P&lt;crt&gt;\d+)\s+(?P&lt;name&gt;(?:(?:[a-z0-9A-Z\-\/])+[ ]{1})+)\s+(?P&lt;um&gt;[a-z]*)(?:[ ]*)\s+(?P&lt;quantity&gt;\d+)(?:[ ]*)\s+(?P&lt;price&gt;\d+.\d+)\s+(?P&lt;value&gt;\d+.\d+)\s+(?P&lt;vat_value&gt;\d+.\d+)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-01
    • 2014-08-06
    • 2016-08-17
    • 2010-12-12
    • 1970-01-01
    • 2020-03-10
    • 1970-01-01
    相关资源
    最近更新 更多