I have a mongodb collection like this:
name: 'john'
family: '"smith"'
i want to remove "
from first and end of family, for example convert '"smith"'
to 'smith'
. i know should use update and regular expression like this /^"/, but how?
Thanks for any reply.
Javascript example:
> '"smith"'.replace(/^"|"$/g, '')
'smith'
/^"|"$/g
matches leading quote ( ^"
) or ( |
) or trailing quote ( "$
).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.