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
/. 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 * ?
Try this (ready to copy-paste):
"!\\[[^\\]]+\\]\\([^)]+\\)"
See here for info about how to get the matches.
"Untainted" version:
!\[[^\]]+\]\([^)]+\)
! literally !\[ escaped [[^\]]+ as many not ]s as possible\]\( escaped ]([^)]+ as many not )s as possible\) escaped )If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With