ruby on rails - i replace start # character word replace from text -
I replace it with #x instead. My goal is creating clickable links from hashtag text
I used .gsub () but not working
Example:
I think the output has been changed" ddd # tagddd #taghh replaced aaaaa ####b ##place " thanks S = "#tag ddd # tagddd #taghh #tag aaaaa ##### Tag B ### Tag" str = "#tag" s .gsub (/ \ b "# {str}" / b /), " Substituted ")
s = "#tag ddd # tagddd #taghh #tag aaaaa ##### Tag B ### Tag "str =" #tag "s.gsub (str," replace ") # = & gt; "Replace DeedWorlds # TagDead #Tehgh AAAAAAH #### Replaced B ##"
Comments
Post a Comment