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

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -