Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Atef95's avatar

Group using wildcards

Hi everyone!

I've a table in my DB called feeds .

The feeds have names..

Meanwhile , I've a templates table that contains values which are tags or indexes I use for search and grouping!

For example one template could include the following values :

1:south_stand,  2:Gate$
1:south_stand, 2:Switch_3 3:Port$

The $ replaces digits

so periodically I've to loop through the templates and form groups according to the values set!

One of the results could be the following :

South Stand Gate 1 
South Stand Switch 3 Port 1
South Stand Gate 2
South Stand Switch 3 Port 2

...etc according to the template I'm setting!

Is it possible to implement that using SQL wildcards ? and how can I do the grouping ? Thanks!

0 likes
4 replies
MohamedTammam's avatar
Table::where('column', 'LIKE', 'Port%'); // % represents any characters for any numbers (like * in regex)
Atef95's avatar

@MohamedTammam it should groups the data by wildcard and by the order of values

There is an example above

Please or to participate in this conversation.