Fork me on GitHub
#cursive
<
2020-08-03
>
reefersleep08:08:16

This is really more of an IntelliJ question, but perhaps someone here has an idea about this, since it’s relevant in a Clojure context. In the interest of keeping lines short, I might sometimes break up a string literal in more than one line, eg.

"This is my
multiline string"
If I were to search for this in IntelliJ, I’d normally just use “Find in Path” (CMD F on Mac). However, if I typed this into the search field, I would find nothing: This is my multiline. I’d have to turn regex on and search for This is my\s*multiline. However, since I won’t know where line breaks are, I’d really have to search for This\s*is\s*my\s*multiline. This becomes really cumbersome really quick! I wonder if there’s a way to assume or specify that each space in a search represents \s*? Or some other, smart way to search for this type of literal?

manutter5111:08:32

I don’t know any way to directly do what you want, but you could set up a Live Template that would make it easy to generate your search string in a REPL..

reefersleep13:08:37

Not exactly what I’m looking for, but it’d be a help. How do I make it available to the REPL?

manutter5113:08:10

Once you define it you can use it in either the repl or the editor just by typing as[TAB]

manutter5113:08:30

where [TAB] is the TAB key, of course.

reefersleep07:08:59

Cheers @U06CM8C3V, an extra weapon for the arsenal 🙂

manutter5111:08:03

(println (clojure.string/replace "Here is some test text." " " "\\s+"))
Here\s+is\s+some\s+test\s+text.