示例:工作“工作与工作
结果:[“工作与工作”]
示例:锻炼对“健康”来说“好” 结果:[“好”,“健康”]
我想在javascript中使用它们
答案 0 :(得分:1)
This answer正是您正在寻找的内容,包括下面的代码段以及快速参考说明。
SELECT total_sum, userId
FROM (SELECT u.id as userId, u.orientation as userOrientation, u.gender as userGender, m1.sum1, m2.sum2, (m1.sum1 + m2.sum2) AS total_sum
FROM (SELECT * FROM user
WHERE gender = 'female'
AND orientation IN ('hetero', 'bi')
AND lastLogin > 1512873464582
) u
INNER JOIN (SELECT user1, COUNT(*) as sum1
FROM `match`
WHERE createdAt > DATE('2017-12-11 00:00:00')
GROUP BY user1
) m1 ON m1.user1 = u.id
INNER JOIN (SELECT user2, COUNT(*) as sum2
FROM `match`
WHERE createdAt > DATE('2017-12-11 00:00:00')
GROUP BY user2
) m2 ON m2.user2 = u.id
) as total
WHERE total_sum < 4
ORDER BY total_sum ASC
LIMIT 8
使用Javascript作为示例:
(["'])(?:(?=(\\?))\2.)*?\1
([“”])匹配报价; ((?=(\?))\ 2.。)如果存在反斜杠,则吞噬它,以及是否发生反复,匹配一个字符; *?匹配很多次(非贪婪,不吃关闭报价); \ 1匹配用于打开的相同引用。
答案 1 :(得分:0)
也许像这样的正则表达式会起作用:
str.match(/\w+|"[^"]+"/g)
答案 2 :(得分:0)
你可以做到
string
&#13;
答案 3 :(得分:0)
var words = 'Exercise is "good" for "health"'.match(/(?<=")([\w]*?)(?=")/g);
console.log(words)