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})"? 

tested


that said, ending optional useless. also, have unneeded square brackets, , stars suboptimal. fixed:

[pp]iece(?:_?[ii][dd])?\s*(?:=\s*)?"?(?<pieceid>[a-z0-9]{16}) 

tested


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -