Created
October 17, 2021 18:49
-
-
Save lior-amsalem/7528dbc2747413e3dbc1352c2e600ffd to your computer and use it in GitHub Desktop.
Strip comment #test
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
/** | |
var result = solution("apples, pears # and bananas\ngrapes\nbananas !apples", ["#", "!"]) | |
// result should == "apples, pears\ngrapes\nbananas" | |
**/ | |
function solution(input, markers) { | |
return input.replace(new RegExp('(\\s?['+markers.join('?') + '?' + '\-?]\\s?)(.*)','gm'),''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment