generated from ossf/project-template
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #629 from ossf/python-ruby-permissive
Fix "Correctly Using Regex" table for Python and Ruby
- Loading branch information
Showing
4 changed files
with
21 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import re | ||
|
||
print('Test Python regex') | ||
print("Must be false: ", bool(re.search(r'^wrong$', "hello"))) | ||
print("Must be true: ", bool(re.search(r'^hello$', "hello"))) | ||
print("True if permissive: ", bool(re.search(r'^hello$', "hello\n"))) | ||
print("Should be false: ", bool(re.search(r'^hello$', "hello\nthere"))) |
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,7 @@ | ||
#!/usr/bin/env ruby | ||
|
||
puts('Test Ruby regex') | ||
puts("Must be false: ", !! /^wrong$/.match("hello")) | ||
puts("Must be true: ", !! /^hello$/.match("hello")) | ||
puts("True if permissive: ", !! /^hello$/.match("hello\n")) | ||
puts("Should be true ($ always multi): ", !! /^hello$/.match("hello\nthere")) |