Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

294
Views
Detect specific string including wildcards and isolate wildcards in PLPGSQL

Is it possible in PostgreSQL 9.4 (PLPGSQL) to detect if a string contains a certain string including wildcards and get the wildcards, ex.:

IF NEW.my_string CONTAINS 'patternXYZ' THEN
    NEW.my_values := getXYZ(my_string)
END IF;

Which would result in NEW.my_values to contain XYZ (which can be anything in the string, but only the 3 characters).

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

SELECT 
   CASE
   WHEN (NEW.my_string like '%patternXYZ%')
      THEN substring(NEW.my_string from '+pattern+') 
      ELSE '00'
   END AS data
FROM my_table;

Pattern should be the parameter for query.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!