search
  • Sign In
  • Sign Up
Password reset successful

Follow the proiects vou are interested in andi aet the latestnews about them taster

1 answers
Q&A Regular expression to match words
Regular expression to match words
P粉957723124 2024-04-06 21:24:04 Views 1962

0

I have a script where I am trying to match new job names with existing job names 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 for the new position, in this case Software Developer,USA. I want to match it to the database's existing job title "Software Developer". The regex code above works for some positions but not others. Please help develop a more comprehensive plan.

I am using mysql V8.

Your Answer
submit

1 answers
0
  • You don't need to test the beginning/end of the string; these are "word boundaries".

  • MySQL 8.0 uses \b as two word boundaries instead of and

  • In some cases, 8.0 requires doubling backslashes.

This may work:

REGEXP CONCAT('\b', j.Description, 's?\b')
2024-04-07 00:55:41

submit

Popular tool

vc9-vc14 (32+64 bit) runtime library collection (link below)

vc9-vc14 (32+64 bit) runtime library collection (link below)

Download the collection of runtime libraries required for phpStudy installation

VC9 32-bit

VC9 32-bit

VC9 32-bit phpstudy integrated installation environment runtime library

PHP programmer toolbox full version

PHP programmer toolbox full version

Programmer Toolbox v1.0 PHP Integrated Environment

VC11 32-bit

VC11 32-bit

VC11 32-bit phpstudy integrated installation environment runtime library

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use