regex - How to strip and get the code between two lines in PHP? -
i'm trying assign variable in php, regex , preg_replace
i've tried doesn't me. here sample text.
claim code: 7241b-2hwrxr9-2p2ba $1.00
i want pull out in middle, 7241b-2hwrxr9-2p2ba
.
you can use following match:
claim code:\s*([\w-]+)\s*\$(\d+(?:\.\d+)?)
and can pull out whatt want $1
see demo
Comments
Post a Comment