My apologies if this has already been answered, bu...
# linting
e
My apologies if this has already been answered, but I'm trying to branch a channel with regex for a variable and I'm getting a linting error:
Copy code
Channel
                .fromPath( included_primers )
                .branch {
                    match : it =~ /${params.primer_set}_*/
                }
This gives the error
Unexpected input: '/'
What is the syntax I'm supposed to use for this? I have a branch elsewhere in this file that doesn't show the error, so I feel like it's due to the variable, but I'm willing to be corrected.
a
I noticed something similar and though it was due to the "slashy string" being disallowed by the new nextflow syntax, but according to the docs it's fine. Wondering if perhaps it's an actual bug @Ben Sherman
Oh actually I see that the VSCode docs note that slashy strings cannot be interpolated. The other docs should probably also have this note added
In terms of a fix I think you can just use a normal
"
string instead of the slashy one
b
indeed slashy strings cannot be interpolated in the strict syntax but a little known fact is that the regex doesn't have to use slashes, it can also be a regular string:
Copy code
it =~ "${params.primer_set}_*"
👍 3