D
Dave Thacker
I need to search a roster file (plain text) to match for a player name. I
tried this:
dthacker@buckbeak:~/learning/ruby$ irb
irb(main):001:0> player="S_Avrul"
=> "S_Avrul"
irb(main):002:0> player_line="S_Avrul ger 25 R 1 2 3 7 40 35"
=> "S_Avrul ger 25 R 1 2 3 7 40 35"
irb(main):003:0> re=/player/
=> /player/
irb(main):004:0> re.match(player_line)
=> nil
irb(main):005:0>
How can I use the value of "player" to create the regex?
TIA Dave
tried this:
dthacker@buckbeak:~/learning/ruby$ irb
irb(main):001:0> player="S_Avrul"
=> "S_Avrul"
irb(main):002:0> player_line="S_Avrul ger 25 R 1 2 3 7 40 35"
=> "S_Avrul ger 25 R 1 2 3 7 40 35"
irb(main):003:0> re=/player/
=> /player/
irb(main):004:0> re.match(player_line)
=> nil
irb(main):005:0>
How can I use the value of "player" to create the regex?
TIA Dave