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

157
Views
Regular expression in mysql to answer the given query

my mysql table has a column structure that dumps various attributes which is separated by ";" for each of the element of a html file.

+-----------+------------------------------------+
| tag_id    | attributes                         |
+-----------+------------------------------------+
|  1        |class:block_22;id:toc_id_35;        |
|  2        |class:bloack_1000;id:12#4           |
+-----------+------------------------------------+

I want to write a query that selects the rows that have

  1.id attribute that starts with #
  2.id attribute that ends with #
  3.id attribute that has # in between

the first query can be answered this way

SELECT * FROM table where attributes like "%id:#%";

I am not sure of how to handle the other two queries . Please give me some valuable insights.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

These patterns should do what you want:

where attribute regexp 'id:#'
where attribute regexp 'id:[^;]*#(;|$)'
where attribute regexp 'id:[^;]+#[^;]+'
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!