Re: gsub not working. Ruby thinks I'm in an array?



Peter Bailey wrote:
Peter Bailey wrote:
registries.sort!
registries.each do |registry|
registry.gsub!(/<\/*registrationList>/, "")

Thanks, Sebastian. OK, I did a .flatten, which I read more about and
looks like a very cool method. Now, I don't get an error message, but, I
don't get any substitutions either!

Yes, I didn't notice this the first time because I was only focussing on the
error you were getting, but the gsub! is basically useless there. You're
using it to modify registry which is thrown away at the end of the iteration.
each doesn't modify the array over which it iterates for that you want map:
registries.map! do |registry|
registry.gsub(/<\/*registrationList>/, "")
end
(This assumes that registries is already flattened, otherwise use registry[0]
instead of registry. Thinking about it that might actually be better because
it saves you the flatten step)

You suggest doing a gsub! on
registry[0], but, that's just the first entry.

registry only ever has one entry because the scan regex has only one capturing
group.


HTH,
Sebastian
--
Jabber: sepp2k@xxxxxxxxxx
ICQ: 205544826

.



Relevant Pages

  • Re: Steve Maillets FAQ for automating activesync
    ... Note quite sure what the first entry is doing there. ... up a 38400 connection but the first entry shows a 19200. ... using Remote Registry ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Most Recent Files Listing
    ... > In my application which allows a user to open specific AutoCAD script files ... > And I've never written anything to the Registry. ... the first entry could be the number to list, such that the user can easily set that value ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Most Recent Files Listing
    ... > In my application which allows a user to open specific AutoCAD script files ... > And I've never written anything to the Registry. ... the first entry could be the number to list, such that the user can easily set that value ...
    (microsoft.public.dotnet.general)
  • Re: floppy disc drive missing
    ... That KB Article is the appropriate one.But if you are not sure how to manage the registry then it's better to leave that.And if you want to go ahead with the instructions as described in the mentioned KB Articlethen make sure to back up the registry before you modify it. ... My Computer Drives ... and it says modify registry at your own risk. ... Will the instructions work or do you have other suggestions? ...
    (microsoft.public.windows.mediacenter)
  • Re: Geode Display corruption
    ... > Modify Registry ... >> Geode/MediaGX display driver that's part of platform builder. ... >> The display looks ok on a CRT when the registry is set to disable the ...
    (microsoft.public.windowsce.platbuilder)