[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: removing spaces between single characters with regual expression

Gavin Kistner

9/12/2006 7:52:00 PM

From: ciapecki [mailto:ciapecki@gmail.com]
> > irb(main):006:0> s.gsub( /\b([a-z]) (?=[a-z]\b)/i, '\\1' )
> > => "A long cat and a quick mouse met oj simpson on the tcp stack"
>
> this is exactly what I need.
> Is it possible to rewrite it without using lookahead (?=subexp) ?

I don't think so, unless you have a positive lookbehind instead.

Why don't you want the lookahead? Are you actually using this regexp
with a language other than Ruby?

2 Answers

ciapecki

9/12/2006 7:58:00 PM

0

> Why don't you want the lookahead? Are you actually using this regexp
> with a language other than Ruby?

right. I need to write it later in oracle pl/sql, but right now wanted
to play a little with powerful ruby :)
Thanks again for your help
chris

Don Guillett

11/21/2008 11:36:00 PM

0


That's exactly what my macro does, AS WRITTEN. Try it.
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com
"cru" <cru@discussions.microsoft.com> wrote in message
news:1A986141-49E6-413C-945D-AFA95ACE90BA@microsoft.com...
> Don,
>
> Thank you for information.
>
> Can I just insert the first three lines into the Comp_Button? (I'm sorry
> for the stupid question).
>
> I wanted to run the spell checking upon pressing_comp button and then
> copy/paste the information on Y29:BG29 into Refund Spreadsheet.
>
> thanks.
>
>
> "Don Guillett" wrote:
>
>>
>> Perhaps you meant to select the Input Form sheet?. However, selections
>> aren't necessary or desirable
>>
>> Sub checkspelling()'Notice the DOTS on the indented lines
>> With Sheets("Input Form")
>> .Unprotect "password"
>>
>> .Range("D12,D13,D14,D15,D17,D22,D24,D26,D29,D30,D31,D32,G32,A55,A57,A59").checkspelling
>> .Range("Y29:BG29").Copy
>> Sheets("REFUND SPREADSHEET").Range("A4").PasteSpecial
>> Paste:=xlPasteValues
>> .protect "password"
>> End With
>> End Sub
>>
>> Sub Comp_Button()
>>
>> Sheets("Input Form").Unprotect "password"
>> Range("D12,D13,D14,D15,D17,D22,D24,D26,D29,D30,D31,D32,G32,A55,A57,A59").Select
>> Selection.CheckSpelling
>>
>> Range("Y29:BG29").Select
>> Selection.Copy
>> Sheets("REFUND SPREADSHEET").Activate
>> 'Range("A4").Select
>> Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
>> SkipBlanks _
>> :=False, Transpose:=False
>> Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
>> SkipBlanks:=False, Transpose:=False
>> End Sub
>>
>>
>> --
>> Don Guillett
>> Microsoft MVP Excel
>> SalesAid Software
>> dguillett1@austin.rr.com
>> "cru" <cru@discussions.microsoft.com> wrote in message
>> news:E03F29A4-BCD0-453A-A249-BEFB85B1A716@microsoft.com...
>> > Hi Everyone,
>> >
>> > Does anyone know why I would get this error message?
>> >
>> > Here's the code:
>> > Sub Comp_Button()
>> >
>> > Sheets("Input Form").Unprotect "password"
>> > Range("D12,D13,D14,D15,D17,D22,D24,D26,D29,D30,D31,D32,G32,A55,A57,A59").Select
>> > Selection.CheckSpelling
>> >
>> > Range("Y29:BG29").Select
>> > Selection.Copy
>> > Sheets("REFUND SPREADSHEET").Activate
>> > 'Range("A4").Select
>> > Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
>> > SkipBlanks _
>> > :=False, Transpose:=False
>> > Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
>> > SkipBlanks:=False, Transpose:=False
>> > End Sub
>>
>>