String spliting

data = “<input type=“password” value=“hoax”>”

spl = data.split("“password”")

The first example works exactly like it should, but when i’m loading the
same line from file it doesn’t, even though they are both strings.

Here is the second example

fp = File.open(‘file’,‘r’).read

spl = data.split(/\“password”")

How come i can’t use the first approach? Is there really difference
between string and a string?

On Sep 26, 2013, at 7:04, Michael J. [email protected] wrote:

spl = data.split(/\“password”")

\ -> \

and add / to mark the end of the RegEx

PS: dont use
File.open(‘file’,‘r’).read

because it holds the FilePointer Open, use

File.read(‘file’)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs