473,394 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to split string around textarea tags?

I would like to split a string of HTML output into an array on
textarea tags. Example:

<div>Hello this is my content <textarea>foo</textareaand this is
also
content <b>some bold text</b<textarea>bar and so forth...</textarea>
here my final content.</div>

The output should be:

Array(
0 =<div>Hello this is my content
1 =<textarea>foo</textarea>
2 =and this is also content <b>some bold text</b>
3 =<textarea>bar and so forth...</textarea>
4 =here my final content.</div>
);

I am fairly new to PHP, so I've been browsing php.net and found some
usefull functions, including strstr, explode and str_split but don't
know how to combine these into a working function. Could anybody
please help me on my way? Your help is appreciated!
Jan 4 '08 #1
1 2626
nu*******@yahoo.com wrote:
I would like to split a string of HTML output into an array on
textarea tags.
*If* you're dealing with well-formed XHTML, try out simplexml.

Besides that, grab a hold onto a book on compilers and parsers.
Cheers,
--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Un ordenador no es un televisor ni un microondas, es una herramienta
compleja.
Jan 4 '08 #2

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

Similar topics

3
by: dan glenn | last post by:
hi. I want to code a 'preview' function into a guestbook entry page. I can do it with a button that posts, bringing up a whole new page showing a preview of what has been entered, and then the user...
4
by: Brian Glen Palicia | last post by:
My goal is to accept input from the user into a text box and then parse the data using split(). The first step is this tiny program to test the split() function. It runs in IE, but in Mozilla it...
5
by: Sen Haerens | last post by:
I'm using string.split(/^$/m, 2) on a curl output to separate header and body. There’s an empty line between them. ^$ doesn’t seem to work... Example curl output: HTTP/1.1 404 Not Found...
0
by: lawrenceS59 | last post by:
Hi all, I'm fairly new to web development so bare with me. The html page that i've created isn't working and i can't figure out why. I'm guessing there are some rules that need to be followed...
6
by: Gabriella | last post by:
Hi, I have a textarea, where the user can enter any given string. He can also insert HTML tags, if he/she wishes. Once I obtain the textarea's string as HTML through form.body.innerHTML, I...
1
Atli
by: Atli | last post by:
The following small HowTo is a compilation of an original problem in getting some cookie-values through different methods of string-handling. The original Problem was posted as follows: As...
2
by: dennis.sprengers | last post by:
Ik ben bezig met een eigen UBB editor. Als iemand aan het typen is, zorgt CTRL-B voor een \-tag en nogmaals CTRL-B voor een \ tag. Als je eerst een selectie maakt en dan CTRL-B drukt, wordt de...
1
by: cabbiepete | last post by:
In the thread http://www.thescripts.com/forum/thread11792.html this question was posed and while an answer was posted it wasn't explained at all why that worked. I thought I would post the answer in...
5
by: laredotornado | last post by:
Hi, If my variable contains var v = "Hi<BR/>there<BR/>"; and attempt to set the value of my textarea like so: dojo.byId("appEditForm:txtDesc").value = v;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...

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.