I've a long text in Java, which contains at least one markdown image syntax. If there're N
markdown image syntax, I will need to split the string into N+1
substrings and store them in an array of String, call texts
. For example, I've the following text
Hello world!

Hello Stack Overflow!
Then Hello world!\n
will be stored in position 0 and \nHello Stack Overflow!
will be stored in position 1. For my question, we can assume that
- The Alt text part contains only character A-Z, a-z and blank space.
- The URL part contains only digits 0-9 and slash
/
. Its extension will only be.jpg
. Other extension will not exist.
My question is how to split the text ? Do we need a java regular expression, such as *
?