Created
February 4, 2017 15:03
-
-
Save roalcantara/bb191aa621d74097c5645f1e4d598c72 to your computer and use it in GitHub Desktop.
Ruby: Removing tags with gsub and regex
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
| str = ''' | |
| <input maxlength=\"1\" size=\"1\" onfocus=\"inputFieldFocus(this)\" onkeyup=\"autotab(this,1,event)\" class=\"screen_color_UNA screen_field \" value=\"\" name=\"IF_642\" type=\"text\"> 213.897.176 | |
| <input maxlength=\"1\" size=\"1\" onfocus=\"inputFieldFocus(this)\" onkeyup=\"autotab(this,1,event)\" class=\"screen_color_UNA screen_field \" value=\"\" name=\"IF_722\" type=\"text\"> 213.897.077 | |
| ''' | |
| str.gsub(/<input(.*?)"> /, '') | |
| # => "\n213.897.176\n213.897.077\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment