how to properly escape single quotes in regexp? #938
|
There may be better ways to do this than As you can see, that returns a value that isn't in the string at all. I'm pretty sure that's from But I'm really curious about a couple things:
|
Replies: 1 comment 1 reply
|
With the In terms of the main ask, I think you'd be fine just with double quotes here, eg: regexp "s/.*prettyName='(.*)'.*$/\$1/)"Note here that I have escaped You can also use https://murex.rocks/commands/regexp.html#find-elements
|
With the
%()incantation,$1is the reason you're seeing--quiet. If this is just a script then$1would be the parameters passed to Murex. Which, in hindsight, isn't what you'd expectIn terms of the main ask, I think you'd be fine just with double quotes here, eg:
regexp "s/.*prettyName='(.*)'.*$/\$1/)"Note here that I have escaped
\$1You can also use
f/...to simplify the query:https://murex.rocks/commands/regexp.html#find-elements
f/...might have some surprises if your string contains multiple instances of prettyName, but i don't think that's going to be a problem here.