Hello.
I tried this:
var s = $(new String("1234,5678"));
s = s.sub("." , ","); // gives ".234,5678" this is
ok, becaus . is a
regex char
s = s.sub("\.", ","); // gives the same output as input, i
think this
isnt correct, the point should be comma
Does i oversee anything?
Bye!
Dan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
I''m not sure why you need to call $.
I''m also seeing identical results when using sub(''.'',
'','') and
sub(''\.'', '','')
- kangax
On Apr 9, 9:04 am, Dan
<danilo.reinha...-/6JGXy0y6WPwg0mx9ZtNsQ@public.gmane.org>
wrote:> Hello.
>
> I tried this:
>
> var s = $(new String("1234,5678"));
>
> s = s.sub("." , ","); // gives ".234,5678"
this is ok, becaus . is a
> regex char
> s = s.sub("\.", ","); // gives the same output as
input, i think this
> isnt correct, the point should be comma
>
> Does i oversee anything?
> Bye!
> Dan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
$() method is for dom elements, not strings. http://www.prototypejs.org/api/utility/dollar I don''t use String#sub at all so I am less familiar about its workings but this doesn''t seem right. If you pass it a string it should escape all regexp special chars l similar to mootools method String#escapeRegExp. Please read about submiting a ticket here: http://www.prototypejs.org/contribute and please include a link to this discussion in the ticket. Thanks. JDD --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
There''s a not yet documented "RegExp.escape" in prototype. Check it out. - kangax On Apr 9, 10:00 am, jdalton <John.David.Dal...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> $() method is for dom elements, not strings.http://www.prototypejs.org/api/utility/dollar > > I don''t use String#sub at all so I am less familiar about its workings > but this doesn''t seem right. If you pass it a string it should escape > all regexp special chars l similar to mootools method > String#escapeRegExp. > > Please read about submiting a ticket here:http://www.prototypejs.org/contribute > and please include a link to this discussion in the ticket. > > Thanks. > JDD--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Ahh I should have known (I saw that on my wallpaper, which is your 1.6.0.2 cheatsheet). Regexp.escape is actually better than the mootools one (has more chars to escape).... Why isnt String#sub/gsub using it? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---