Afficher un message
Vieux 20/11/2007, 21h29   #4
Robert Keller
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: gsub question on special charaters

Note: parts of this message were removed by the gateway to make it a legal Usenet post.

Thanks! The explanation ed. I just ordered
Mastering Regular Expressions
<http://www.amazon.com/Mastering-Regular-Expressions-Jeffrey-Friedl/dp/0596528124/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1195585371&sr= 1-1>


Mastering Regular Expressions
<http://www.amazon.com/Mastering-Regular-Expressions-Jeffrey-Friedl/dp/0596528124/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1195585371&sr= 1-1>
by Jeffrey Friedl


--
Robert Keller
--------------------------------------------------
robert.keller@yahoo.com



Ben Atkin wrote:
> Yours doesn't work because characters in the square brackets can't be
> escaped. Instead of matching that character, it will match "\", "^",
> or "L". Phrogz has the right answer; just thought I'd explain why his
> works and yours doesn't.
>
> Ben
>
> On Nov 20, 2007 11:18 AM, Robert Keller <rlkeller@yahoo.com> wrote:
>
>> I have a string that looks like this :
>>
>> ts = "^LThe beginning of the sentence"
>>
>> I want to remove the "^L"
>>
>> I've tried
>>
>> ts.gsub!(/^[\^L]/,'')
>>
>> which removes the "^", but I need to remove the "^L" when they are
>> together and at the beginning of the sentence.
>>
>> Any is welcome
>>
>>
>> --
>> Robert Keller
>> --------------------------------------------------
>> robert.keller@yahoo.com
>>
>>
>>
>>

>
>
>
>


  Réponse avec citation
 
Page generated in 0,07798 seconds with 9 queries