embulk-parser-regexのエラー対応
Embulkプラグインのembulk-parser-regexで、regexのキーに、_(アンダースコア)を含めるとエラーになる。
regexを使う時は、キーに_を使わないようにしよう。
エラーメッセージ
Error: java.util.regex.PatternSyntaxException: named capturing group is missing trailing '>' near index 125
^(?<from>[^%]+)%(?<uid>[^%]+)%(?<did>[^%]+)%(?<mid>[^%]+)%(?<type>[^%]+)%(?<to>[^%]+)%(?<status>[^%]+)%(?<ts>[^%]+)%(?<status_desc>[^%]+)%(?<host>[^%]+)%(?<uuid>[^%]+)$
^
confg.ymlのサンプル
parser:
type: regex
# エラーが出る。
# regex: ^(?<from>[^%]+)%(?<uid>[^%]+)%(?<did>[^%]+)%(?<mid>[^%]+)%(?<type>[^%]+)%(?<to>[^%]+)%(?<status>[^%]+)%(?<ts>[^%]+)%(?<status_desc>[^%]+)%(?<host>[^%]+)%(?<uuid>[^%]+)$
# アンダースコアを消すとうまくいく。
regex: ^(?<from>[^%]+)%(?<uid>[^%]+)%(?<did>[^%]+)%(?<mid>[^%]+)%(?<type>[^%]+)%(?<to>[^%]+)%(?<status>[^%]+)%(?<ts>[^%]+)%(?<statusdesc>[^%]+)%(?<host>[^%]+)%(?<uuid>[^%]+)$
columns:
(snip)
# regex_nameもアンダースコアを修正
# - {name: status_desc, type: string, regex_name: status_desc}
- {name: status_desc, type: string, regex_name: statusdesc}
(snip)