473,326 Members | 2,182 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,326 software developers and data experts.

Need help creating regular expression for html lists...

I'm working on regular expressions to parse html tags into the wiki
syntax. i.e. for example, if i encounter text like - some <bmore </
btext, my regular expression should be able to convert that to some
'more' text. Simple things like the above, i was able to write but the
real problem lies when it comes to parsing lists and tables.

For example, i write down some text as follows -

# number one

# number two

# number three

i want to be able to convert that into html code -

<ol>

<li>number one</li>

<li>number two</li>

<li>number three</li>

</ol>

i was able to find out the first occurance and last occurance of #,
append a <olthere and get the number one/two/three within <li></li>.
So far so good...But the problem occurs when i have multiple lists on
the same page. Obviously, my search for the first and last occurance
of # will not be as desired as there are two lists in the page. i.e.

# number one

# number two

some text here

# number one

# number two

then unfortunately my parsing into html yields me

<ol>

<li>number one</li>

<li>number two</li>

some text here

<li>number one</li>

<li>number two</li>

</ol>

and not as

<ol>

<li>number one</li>

<li>number two</li>

</ol>

some text here

<ol>

<li>number one</li>

<li>number two</li>

</ol>

Can anybody help???

I'm trying out the above using VB.Net as well as javascript. So any
help in either of the languages is most welcome...

Mar 21 '07 #1
0 1152

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

Similar topics

1
by: Neil Morris | last post by:
Hi I have the following code that lists first names of people who's surnames are 'Morris'. What I am trying to do is search for first names that don't start at the beginning of the line ie. have...
4
by: Buddy | last post by:
Can someone please show me how to create a regular expression to do the following My text is set to MyColumn{1, 100} Test I want a regular expression that sets the text to the following...
3
by: Joe | last post by:
Hi, I have been using a regular expression that I don’t uite understand to filter the valid email address. My regular expression is as follows: <asp:RegularExpressionValidator...
26
by: Charles Law | last post by:
Does anyone have a regex pattern to parse HTML from a stream? I have a well structured file, where each line is of the form <sometag someattribute='attr'>text</sometag> for example <SPAN...
2
by: comp.lang.php | last post by:
I am trying to replace within the HTML string $html the following: With Where I'm replacing "action=move_image" with "action=<?= $_REQUEST ?>"
0
by: anand1107 | last post by:
I'm working on regular expressions to parse html tags into the wiki syntax. i.e. for example, if i encounter text like - some <bmore </ btext, my regular expression should be able to convert that...
7
by: oscartheduck | last post by:
Hi folks, I'm trying to alter a program I posted about a few days ago. It creates thumbnail images from master images. Nice and simple. To make sure I can match all variations in spelling of...
3
by: =?Utf-8?B?VEo=?= | last post by:
Hi, I want to know how Regular Expression can be used in this situation. I want to replace some string in specific condition.. The condition is to replace string only if the string is NOT inside...
8
by: Uwe Schmitt | last post by:
Hi, Is anobody aware of this post: http://swtch.com/~rsc/regexp/regexp1.html ? Are there any plans to speed up Pythons regular expression module ? Or is the example in this artricle too...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.