-
-
Save anonymous/5a94c4512081960304f7 to your computer and use it in GitHub Desktop.
I am trying to look through a text file and return 1 if the file contains the string "attach" on a line that doesn't start with >. Otherwise return 0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#test case - should return a 0 | |
#> asdf asdfkla sdfaklsd fasd lfaslk fa | |
#> asdlfka sdfkl asdfkl asflka sflkasjd flkasdjf | |
#> askldfj asdlfk asdlfk asdlf kasdk lfas dlkfasdf | |
#>attach aslkdfjasdfl asdf asldkf asd | |
#asdfkljas d | |
#test case - should return a 1 | |
#fakdjfksjf attach | |
#>dkjfakjf dkfdjaf | |
text = IO.read(ARGV[0]) | |
if text =~ /^>.*(?=.*)attach/ | |
exit 1 | |
else | |
exit | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment