regex - Generating Regular Expression Parsing -
i need convert 4 lines below single regular expression.
piece_id="e00401007758725d" pieceid = e00401007758725d piece=e00401007758725d piece e00401007758725d
i've tried following:
[pp]iece[_]*?[ii]*[dd]* ?[=]* ?"?(?<pieceid>[a-z0-9]{16}"?)
but output looks e00401007758725d"
i followed regex link checking expression.
if don't want capture "
, move "?
out of capture.
[pp]iece[_]*?[ii]*[dd]* ?[=]* ?"?(?<pieceid>[a-z0-9]{16})"?
that said, ending optional useless. also, have unneeded square brackets, , stars suboptimal. fixed:
[pp]iece(?:_?[ii][dd])?\s*(?:=\s*)?"?(?<pieceid>[a-z0-9]{16})
Comments
Post a Comment