Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

need help on pattern substitution

0 views
Skip to first unread message

Yulong Zhou

unread,
Mar 22, 1996, 3:00:00 AM3/22/96
to

I have a question about pattern substitution!

if I have a string like the following!

Helloabcdehello12345HeLLO

I want change it to

<b>Hello<b/>abcde<b>hello<b/>12345<b>HeLLO<b/>


is there a way in perl to do this,the important thing here, is the case
there are upper and lower case.

thanx for your help
I am new in perl!
yul...@ace.rutgers.edu

Tad McClellan

unread,
Mar 25, 1996, 3:00:00 AM3/25/96
to
Yulong Zhou (yul...@ace.rutgers.edu) wrote:


: if I have a string like the following!

: Helloabcdehello12345HeLLO

: I want change it to

: <b>Hello<b/>abcde<b>hello<b/>12345<b>HeLLO<b/>

^^^^
</b> is what you meant to say, right?

: is there a way in perl to do this,the important thing here, is the case


: there are upper and lower case.


------------------------
#!/usr/bin/perl -w

$_ = 'Helloabcdehello12345HeLLO';

s#(hello)#<b>$1</b>#ig;

#s#\b(hello)\b#<b>$1</b>#ig; alternative to not match embedded 'hello'

print "$_\n";
------------------------

--
Tad McClellan, Logistics Specialist (IETMs and SGML guy)
email: mccle...@lfwc.lockheed.com
Money isn't everything ...
but it's way ahead of whatever's in second place.

0 new messages