Do i need a regex?


#1

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


#2

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


#3

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:


#4

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


#5

2006/5/23, newbie removed_email_address@domain.invalid:

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