--------------000501000802090305040506
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

aidy wrote:
> ChrisH wrote:
>   
>> try
>>   /#{line}/ a
>>
>> cheers
>>     
>
> I need shooting. However I get a match with this
>
> "table HINTON ST GEORGE"
> "line HINTON ST GEORGE"
> match
>
> but not with a trailing space
> "table HINCKLEY"
> "line HINCKLEY "
> not match
>
> I can't see a trim in Ruby.
>
> I tried this also /#{line}s*/ 
>
> Thanks so much
>
> aidy
>
>   

trim would be strip:

http://ruby-doc.org/core/classes/String.html#M000625

/#{line}s*/ won't work, because that's saying:

Is "HINCKLEY " in "HINCKLEY" ?

Which of course it isn't.

Also, as a side note, it might be simpler to use the ternary operator:

if /#{line}/ a; p 'match' else; p 'not match'; end

becomes

/#{line}/ a ? p 'match' : p 'not match'


-Justin

--------------000501000802090305040506--