Created
December 23, 2011 21:54
-
-
Save havenwood/1515462 to your computer and use it in GitHub Desktop.
regex methods
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
class Parser | |
def split_pattern text | |
text.split(/(?:[^|]), /) | |
end | |
def match_escape_pattern text | |
text.match(/\|([,{}])/) | |
end | |
def replace_tricky_end_pattern text | |
text.gsub(/(?:[^|]), $/) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment