Skip to content

Instantly share code, notes, and snippets.

@Blasanka
Created January 23, 2020 02:14
Show Gist options
  • Save Blasanka/15bf38fbd0dd20d72b407434b9b013e7 to your computer and use it in GitHub Desktop.
Save Blasanka/15bf38fbd0dd20d72b407434b9b013e7 to your computer and use it in GitHub Desktop.
This is how you can replace hash tag with forward slashes in url
void main() {
String text = "Test #/first1hashtag test #/second2hashtag test.";
RegExp exp = new RegExp(r"\B#\/");
exp.allMatches(text).forEach((match){
print(match.group(0));
text = text.replaceAll(match.group(0), "");
});
print(text);
String text2 = "Test #/first1hashtag test #/second2hashtag test.";
text2 = text2.replaceAll("#/", "");
print(text2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment