Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

161
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda