I have a string like:
hello #this# is #some text string# text text
I want change it to:
hello <sometag>this</sometag> is <sometag>some text string</sometag> text text
That is, replace the first # with an HTML tag and the second # with the closing tag, and so on. I am using Python; any body knows any regular expression or something other method?
If you want to HTML bold everything separated by hashes surrounded by whitespace, you can do this:
If you want to match without space around the hashes, you change the relevant line to these:
BUT this will only match paired hashes. In your example, it would result to
'<b>text</b>text text<b>text</b>text#text text'