From: Ken Bloom Date: 2008-11-17T04:36:54+09:00 Subject: Re: gsub and reg expressions On Sun, 16 Nov 2008 14:00:26 -0500, Stuart Clarke wrote: > I am having a few problems getting gsub to work with my regular > expressions. > > I have a field full of data and therefore I am using a regular > expression to extract one part of it - #{event.description[/Logon > Type:\t2/]} > > This works fine. I want to now add in gsub to replace 'Logon Type: 2' > with the string 'Local Logon' - #{event.description.gsub([/Logon > Type:\t2/], 'Local Logon')} > > However when i run this code i get the following error: > > C:/Documents and Settings/sc/Desktop/test.rb:116:in `gsub': wrong > argumen > t type Array (expected Regexp) (TypeError) > > Does anyone have any ideas where I am going wrong? > > Many thanks get rid of the [] around the regular expression. event.description.gsub(/Logon Type:\t2/, 'Local Logon') -- Chanoch (Ken) Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/