Do i need a regex?

i am trying to match the string “–(null)–” in ruby

i am doing this after reading a line

if line.match("–null–")
#code here

its not working though

would i need a regex

On Wed, May 24, 2006 at 05:19:53AM +0900, newbie wrote:

i am trying to match the string “–(null)–” in ruby

i am doing this after reading a line

if line.match("–null–")
#code here

its not working though

would i need a regex

You could use a regex but you don’t need to if all you care about is
inclusion of that string.

if line.include?(’–null–’)

marcel

would i need a regex

You could use a regex but you don’t need to if all you care about is
inclusion of that string.

if line.include?(’–null–’)

marcel

marcel that worked perfectly

thank you very much! :slight_smile:

marcel that worked perfectly

I’m surprised: in your original posting you mentioned the string
“–(null)–” which is somewhat different from “–null–”…

robert

i typed mine in with the parentheses

2006/5/23, newbie [email protected]:

would i need a regex

You could use a regex but you don’t need to if all you care about is
inclusion of that string.

if line.include?(‘–null–’)

marcel

marcel that worked perfectly

I’m surprised: in your original posting you mentioned the string
“–(null)–” which is somewhat different from “–null–”…

robert