String replacing with Regex
Posted: Wed Dec 18, 2013 1:03 pm
Hello,
I read on forum and search engines, but I didn't find a solution.
I need to substitute in a text like this:
to html like this:
I can't use replace, since I have to store the content between # and newline.
I can't use neither matchText(), because I don't know how many replace I need.
I only know that a good regex for my seach is:
Do you have any idea?
I read on forum and search engines, but I didn't find a solution.
I need to substitute in a text like this:
Code: Select all
# Title 1
Some text, very long...
# Title 2
Some other text, very long...
...
Code: Select all
<h1># Title 1</h1>
Some text, very long...
<h1>#Title 2</h1>
Some other text, very long...
...
I can't use neither matchText(), because I don't know how many replace I need.
I only know that a good regex for my seach is:
Code: Select all
(\n|^)#.*\n