Created
October 10, 2008 19:18
-
-
Save cscotta/16132 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Basic regex + Ruby method to strip textile formatting. | |
# Handles all test cases at http://hobix.com/textile/ down to "Phrase Attributes." | |
def strip_textile(text) | |
text.gsub(/\b[_+^*~@%\-]{1,2}|[_+^*~@%\-]{1,2}\b|\b\?\?|\?\?\b|h\d\.\s|bq.\s|fn\d\.\s|\D\{.*\}\.\s?|\{.*\}\.\s?|\%\{.*\}|\D\(.*\)\.\s?|\{%.*\%\}\s|<.*?>/, "") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment