Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: Finding un-escaped characters in scan
Stefan Rusterholz
7/28/2007 1:41:00 PM
Fred Phillips wrote:
> I have a string that looks like this: "test,,\,test". And I'm trying to
> count the commas which don't follow a \. But when using scan(/[^\\],/)
> it
> only finds the first comma. I think this is because after scan() has
> found a
> comma without a backslash, it continues from where it left off, and
> since
> there's no character before the next comma, it won't match it. Does
> anyone
> know how to fix it?
Just wanted to point out a mistake the OP and all of the replying people
made:
",,\,," # => ",,,,"
The , is *not* escaped. You need ',,\,,' # => ',,\\,,'
Regards
Stefan
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: Finding un-escaped characters in scan
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password