Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple regex problem 2

Status
Not open for further replies.

Dronealone

IS-IT--Management
Mar 13, 2002
64
GB
Hi,

I just can't get my head around regex!

Can anybody tell me how I do a simple match to extract
what is between the quotes on a select list:

<option value=&quot;bla&quot;>Bla Bla</option>

I want to extract all occurrences of what is between the quotes...

Thank you!!
 
This expresion pattern should work:
Code:
$pattern = &quot;/<option\s+value\s*=\s*&quot;(.*)&quot;>/i&quot;;
Use it with preg_match, the resulting array will contain the results.
The patterns has optional whitespace between the words in case there's some extra white space.
 
DRJ478,
maybe Dronealone forgot to give you a star.
I think you deserved it (lot of people here seem to be quite parsimonious about that!).

Gaetano
 
casters,

Thanks a lot! Your kindness is appreciated.
 
apologies, wasn't aware of the star system! Star has been awarded appropriately now!

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top