E
E
Extramezz2015-09-25 15:23:12
PHP
Extramezz, 2015-09-25 15:23:12

How to make such a routine?

Good day, you need to get from the string:
sdsdas {*TAG*name:[p1,p2,p3]} sdasdas
Or maybe an
asdasdas {*TAG*name} sadsadas
Array

array("name", "p1,p2,p3");
  //Или соответственно только
  array("name");

Even I'm stupid today, help me correctly compose a regular season.
My non-working version:"/{\*TAG\*(.+)(?:\:[(.+)])?\}"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Muhammad, 2015-09-25
@Extramezz

Something like this: \{\*TAG\*([^:}]*)(?:\:([^\]]*)\])?\}

K
Kirill Taran, 2015-09-25
@xkeirainx

Alternative option from a nearby camp:
\*.+\*(?<name>[^:]*)(:\[(?<params>[^}]*)\])?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question