473,399 Members | 3,038 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,399 software developers and data experts.

Regex, how do I replace quotation pairs into <LI> & </LI>?

Basically, my texts consists of normal text stream and some quotations.

This is my text stream, and inside "this streams" there are some "quotation
pairs"
which are to be replaced like this: <LI>this streams</LI> for formatting in
HTML.

Tried ___s/\".*?\"/<li>.*?<\/li>/g;___ but not working.

Thanks.
Kelvin


Jul 19 '05 #1
3 4157
Kelvin wrote:
Basically, my texts consists of normal text stream and some
quotations.


Answered in comp.lang.perl.misc only, since this group is defunct.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
Jul 19 '05 #2
On Thu, 21 Oct 2004 18:27:05 +0800, Kelvin wrote:
s/\".*?\"/<li>.*?<\/li>/g;


No need to escape those "-characters, AFAIK. And you don't want to
replace .*? above with - uhm - the regular expression .*?, do you?

Untested, but I think something like this should do it;

s,"(.*?)",<li>$1</li>,g;

Please read these:

perldoc perlretut
perldoc perlre
--
Tore Aursand <to****@gmail.com>
"Time only seems to matter when it's running out." (Peter Strup)
Jul 19 '05 #3
"Kelvin" <th*********@hotmail.com> wrote in message news:<41********@news.starhub.net.sg>...
Tried ___s/\".*?\"/<li>.*?<\/li>/g;___ but not working.


hi kevin

try
s#"([^"]*)"#<li>$1</$1>#g

matches " (any text but quotes) "
and places (any text..) between <li> and </li>

gerhard
Jul 19 '05 #4

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

Similar topics

3
by: abro | last post by:
Problem: A list contained in a div contains several items that are made of two parts: itemName and itemValue. ie: <div id="data"> <li>longtime1 <span> 1326 mins></span></li> <li>longtime2...
4
by: Matt | last post by:
Hi, Got an unordered list with 100% width, with 5 list items of 20% width styled to fill the width of the container element. Renders fine in Mozilla, but when you change the size of the window...
5
by: Steel | last post by:
Hi at all, please consider this : <ul> <li><a>No link</a></li> <li><a href="#">This is a link</a></li> <li><a>No link</a></li> <li><a href="#">This is a link</a></li> .......................
4
by: Mark | last post by:
Hopefully I 'm missing something silly, but I can't find an easy way to loop all list items in a simple <ol>. I was hoping a for loop as shown below would be enough, however clicking "alert all" in...
24
by: JB | last post by:
Hi All, This is doing my head in! Please help. I've built a simple <ul> to serve as a menu for a page I'm working on. I have tested the menu in Mozilla Fireworks 1.5 and it's fine - nice and...
7
by: gener672 | last post by:
Problem: font-size seems to be rendered differently for <li class="issue"> and for <p class="issue">. (Example is in: www.dvmvac.com/snippet/ ... ignore background - I just did a quick file copy and...
7
by: patrick j | last post by:
Hi I'm wondering about lists with nested lists as one does on a Saturday afternoon. Anyway below is an example of a list with a nested list which the iCab browser's very useful HTML...
9
by: eros | last post by:
<li>List <ul> <li>List1</li> <li>List2</li> <li>List3</li> </ul> </li> How to call the php code from that html tags... when I click List1?
2
by: GloStix | last post by:
For some reason, FF likes to put a black underline on all my buttons. No matter what I do, it has the line I've tried displaying as block and cursor, anything.. Also I've been trying to get it so...
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: 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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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.