-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- The support for Regex variables ($1, $2, ...) is now gone!
Use a match variable instead: var match = /(\w+)\s+(\w+)/.match("hello world"); say match[0]; # prints: "hello" say match[1]; # prints: "world" - Optimized the match[i] caption access: only an array with strings will be created per match, therefore is not equivalent with match.cap[0], which will create a new array each time it is called.
- Loading branch information
trizen
committed
Oct 25, 2015
1 parent
5ed23c9
commit 1eaf761
Showing
6 changed files
with
42 additions
and
32 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/ruby | ||
|
||
var m = /(\w+)\s+(\w+)/.match("foo bar"); | ||
|
||
assert_eq(m[0], 'foo'); | ||
assert_eq(m[1], 'bar'); | ||
|
||
say "** Test passed!"; |