Hello all,
I am trying to split a long regex into different lines. I am aware that string macros can be called with triple quotes. However this introduces a newline at the end. Any way of avoiding this?
Hello all,
I am trying to split a long regex into different lines. I am aware that string macros can be called with triple quotes. However this introduces a newline at the end. Any way of avoiding this?
Perhaps you’d like regex “comment mode” where non-significant whitespace and comments are allowed within the regex string. This is enabled with the x
suffix to the r
string macro:
julia> match(r"(aa| # a comment
bb|
cc)"x, "bb")
RegexMatch("bb", 1="bb")
Yes, this solves exactly the issue (also for the triple quotes). Thank you!