Im busy with a challenge of exercism
I have a line like this :
[error] : This is a error message
So now I have to take out the error part which can also be info or warning and the actual text.
Is there a way I can make this work without a complicated regex ?
If not, can anyone help me to figure out how the regex must look like ?
user> (def s "[error] : This is a error message ")
#'user/s
user> (->> (clojure.string/split s #":")
(map clojure.string/trim))
("[error]" "This is a error message")
And here’s a regex in case that’s helpful:
user> (re-find #"\[([^\]]+)\]\s+:\s+(.+)$" s)
["[error] : This is a error message " "error" "This is a error message "]