What happened when I used the code --

$hello =~ s/^(.+)$/<s>\1<\/s>/gis;

-- is that is properly marked <s> and the beginning of the sentence and </s>
at the end of the sentence, but then it only worked for one sentence.

Any suggestions on getting <s> to appear at the beginning of every sentence
and </s> to appear at the end of every sentence for more than one sentence?

Zach

On Sun, Nov 14, 2010 at 11:53 AM, Uri Guttman <u...@stemsystems.com> wrote:

> >>>>> "sw" == shawn wilson <ag4ve...@gmail.com> writes:
>
>  sw> second, why not use a place holder like someone recommended yesterday?
>  sw> something like:
>  sw> s/^(.+)$/<s>\1<\/s>/g
>
> what is a placeholder? nothing like that in regexes. what you have there
> is a backreference and used in the wrong place. \1 is meant to be used
> ONLY in the regex part, not the replacement section. use $1 to get
> the first grabbed part when in the replacement part. your code will
> generate warnings:
>
> perl -wle '$x = "a" ; $x =~ s/(a)/\1\1/'
> \1 better written as $1 at -e line 1.
> \1 better written as $1 at -e line 1.
>
> uri
>
> --
> Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com--
> -----  Perl Code Review , Architecture, Development, Training, Support
> ------
> ---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com---------
>



-- 
--------------------------------------------------------------------------------------------------
Zachary S. Brooks
PhD Student in Second Language Acquisition and Teaching (SLAT)
The University of Arizona - http://www.coh.arizona.edu/slat/
Graduate Associate in Teaching - Department of English
M.A. Applied Linguistics -  University of Massachusetts Boston
---------------------------------------------------------------------------------------------------

Reply via email to