regular expressions to parse

This is a discussion on "regular expressions to parse" within the JavaScript Forum section. This forum, and the thread "regular expressions to parse are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Mar 21st, 2007, 09:35
New Member
Join Date: Mar 2007
Location: Chennai, IN
Age: 26
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
regular expressions to parse

I'm working on regular expressions to parse html tags into the wiki syntax. i.e. for example, if i encounter text like - some <b> more </b> text, 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 <ol> there 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...
Reply With Quote

  #2 (permalink)  
Old Mar 21st, 2007, 11:32
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: regular expressions to parse

Please post you question in the right forumz!

I've moved them to the Web Development section!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unicode Regular Expression won't work ?? stacioanri JavaScript Forum 2 Jul 28th, 2007 21:52
Extract attribute value with Regular Expression? ScottDC PHP Forum 2 May 18th, 2007 08:37
Help spliting string by regular expression Sagaris PHP Forum 8 May 1st, 2007 20:46
PHP & newlines Refular expressions ktsirig PHP Forum 1 Feb 12th, 2006 18:27


All times are GMT. The time now is 04:29.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43