473,508 Members | 2,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

regs?

Hi Guys!

I need a way to convert a string like this:

<select name="something">
<option value="1">var1</option>
<option value="2">var2</option>
<option value="3">var3</option>
<option value="4">var4</option>
</select>

to this:

something=[1,2,3,4]

Anyone can help?
--
Yang
Jul 17 '05 #1
1 1600
Yang Li Ke wrote:
Hi Guys!

I need a way to convert a string like this:
<?php
$str = <<<STR <select name="something">
<option value="1">var1</option>
<option value="2">var2</option>
<option value="3">var3</option>
<option value="4">var4</option>
</select> STR;


to this:

something=[1,2,3,4]

$str2 = preg_replace('@<select name="(\w*)">.*@s', '$1=[', $str);
preg_match_all('@<option value="(\d)">var\d</option>@', $str, $values);
$str2 .= implode(',', $values[1]) . ']';
?>
--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1211
by: Yannick Benoit | last post by:
Hi! I use this to find all links in a page : *(href)*=*(+) but recently i found out that it only works if links are setup this way: <a href = "... I would like to know if someone can help...
19
5832
by: Lorenzo J. Lucchini | last post by:
My code contains this declaration: : typedef union { : word Word; : struct { : byte Low; : byte High; : } Bytes; : } reg;
5
8166
by: rahul8143 | last post by:
hello, I want to know for what purpose union REGS and struct SREGS are used in windows programming? also how following code an determine that running OS is windows? in_regs.x.ax = 0x160A;...
4
7246
by: Bruno Barros | last post by:
Hello, I donīt know if union REGS <dos.h> is part of this group, but i have a problem. At the moment i use turboc++lite and i donīt have reply when i execute the question code. Only a black...
5
9631
by: kushmanr | last post by:
hi i am having to problems: interrupt decleration doesn`t compile: void _interrupt _far terminal_isr() ....... _dos_setvect(0xC,terminal_isr) : error C4226: nonstandard extension used :...
0
2523
by: balajiv86 | last post by:
hi can anyone tell me the book which contains details abt inbuilt union regs in c
0
5828
by: chikas | last post by:
hallo all,I need help and any tips shall be appreciated! i want to implement a I2C API(from Beck SC12 microcontroller) in a 1 wire search C-code(use to search devices on 1 wire bus) sothat that i...
1
1514
by: Marcpp | last post by:
Hi, I need add to a listbox a list of items extracted from a database. This is that I've do: class tasques(wx.Frame): def __init__(self, *args, **kwds): ..... self.list_box_1_copy =...
3
2019
by: vicky | last post by:
Hi, i am vikram Please tell me the usage of REGS key word how it can be used? any kind of suggestions will help me.
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7493
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5049
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.