need a little help with the regexp i make… have some text where links are encoded like
[NameLink ->link] or [NameLink->link]
The link can be without http:// or www.
Tried to get it using this pattern
/\[.{1,}\-\>.{1,}\]/
but if there are 2 such encoded links in a row then it doesn’t separate them and takes also the content between two links. Can someone tell me what’s the problem? Thank you
Use
+?instead of{1,}. Also, have a read on greedy vs. nongreedy.You may want to strip spaces using
\s*around your.+?, this allows for both[NameLink -> link]and[NameLink ->link].