1 Name: Anonymous : 2017-04-03 04:20
For example.
var text1 = "Hello world [[I want to extract this#but not this]] and keep the ending double brackets";
var text2 = "Here is [[another example]] of text I should keep";
var text3 = "And one more [[example keep this|but not this]] but keep closing double brackets";
var text4 = "I want [[to keep this,not this]] same keep closing brackets";
Right now I've got the regex to get what I want from text2 in scala as
var pattern = """\[\[(.*?)\]\]""".r
Which returns everything inside of the [[ ]] but the fucking conditionals to find if a |, comma, or # appear are confusing as fuck.
2 Name: Anonymous : 2017-04-03 06:02
>>1Try this i will assume it's the same syntax and whatever you're using. although it's an easy fix.
$ sed -r 's/^.*\[\[([^\|,#]*).*\]\].*$/[[\1]]/' <<< "Hello world [[I want to extract this#but not this]] and keep the ending double brackets"
[[I want to extract this]]
$ sed -r 's/^.*\[\[([^\|,#]*).*\]\].*$/[[\1]]/' <<< "Here is [[another example]] of text I should keep"
[[another example]]
$ sed -r 's/^.*\[\[([^\|,#]*).*\]\].*$/[[\1]]/' <<< "And one more [[example keep this|but not this]] but keep closing double brackets"
[[example keep this]]
$ sed -r 's/^.*\[\[([^\|,#]*).*\]\].*$/[[\1]]/' <<< "I want [[to keep this,not this]] same keep closing brackets"
[[to keep this]]