REGEXP字匹配
我有一个脚本,试图将新的Jobtitle与数据库中的现有脚本进行匹配。
SELECT
a.title AS JobTitle,
j.Description AS MatchedJobTitle,
f.Description AS Family,
p.ShortDescription AS ColourComplexity,
j.IsCustomerFacing,
j.JobTitleID
FROM JobTitle j
CROSS JOIN Staging.TMP_OC1 a
INNER JOIN JobFamily f ON j.JobFamilyId = f.JobFamilyID
INNER JOIN Pathways p ON f.PathwaysID = p.PathwaysID
WHERE a.title REGEXP CONCAT('([[:<:]]|^)', j.Description, '[s]?([[:>:]]|$)');
staging.tmp_oc1表有一个记录,这是新的作业标题,在这种情况下是软件开发人员,美国。 我想将其与“软件开发人员”的DBS现有职位匹配。 上面的Regexp代码适用于某些职位,但不适合其他职位。 请协助开发一个更全面的。
我正在使用MySQL V8。
I have a script where I am attempting to match a new jobtitle to an existing one in the database.
SELECT
a.title AS JobTitle,
j.Description AS MatchedJobTitle,
f.Description AS Family,
p.ShortDescription AS ColourComplexity,
j.IsCustomerFacing,
j.JobTitleID
FROM JobTitle j
CROSS JOIN Staging.TMP_OC1 a
INNER JOIN JobFamily f ON j.JobFamilyId = f.JobFamilyID
INNER JOIN Pathways p ON f.PathwaysID = p.PathwaysID
WHERE a.title REGEXP CONCAT('([[:<:]]|^)', j.Description, '[s]?([[:>:]]|$)');
The Staging.TMP_OC1 table has one record which is the new job title, in this case Software Developer,USA.
I would like to match it to the dbs existing job title which is 'software developer'.
The regexp code above works for some job titles but not others.
Please assist in developing a more comprehensive one.
I am using mysql V8.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不需要测试字符串的开始/结束;这些是“单词边界”。
mysql 8.0使用
\ b
用于两个字界,而不是[: /代码>
在某些情况下,8.0需要后斜线加倍。
这可能有效:
You don't need to test for beginning/ending of string; those are "word boundaries".
MySQL 8.0 uses
\b
for both word boundaries, instead of[[:<:]]
and[[:>:]]
In some situations, 8.0 needs the backslashes doubled up.
This may work: