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:

S = "#tag ddd # tagddd #taghh #tag aaaaa ##### Tag B ### Tag" str = "#tag" s .gsub (/ \ b "# {str}" / b /), " Substituted ")

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 (str," replace ") # = & gt; "Replace DeedWorlds # TagDead #Tehgh AAAAAAH #### Replaced B ##"    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -