I'm trying to write a snippet. For this post I super simplified it. If I run it on this selection:
arg1
the snippet should output:
doFunc('arg1', 'null');
if I run it on this selection:
arg1, arg2
the snippet should output
doFunc('arg1', arg2);
I can't figure out how to use null
string if no regex match is found. This is what I have so far:
doFunc('${SELECTION/([^,]+)(,.*)?/\1/}', ${SELECTION/([^,]+)(,.*)?/\2/});
So the problem here is ${SELECTION/([^,]+)(,.*)?/\2/}
I want to do like a tertiary so like \2 ? \2 : null
is this possible?
Thanks