Created
March 16, 2017 04:58
-
-
Save wam/a86c51eaad03689a14fcd0d58e6cca0c to your computer and use it in GitHub Desktop.
some img tag to method regexes
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
# pass 1 | |
/<img src="<%= ENV\["IMAGE_URL"\] %>([^"]+)" ([^>]+)>/ | |
image_tag("/static/images$1", $2) | |
# => image_tag("/static/images/icons/app-ui-logo-white.png", id="topbar-logo" alt="Freedom logo") | |
# pass 2 | |
/(\w+)="([^"]+)"/ | |
$1: $2, | |
# => image_tag("/static/images/icons/app-ui-logo-white.png", id: "topbar-logo", alt: "Freedom logo",) | |
# pass 3 | |
/,\)/ | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment