Link to home
Start Free TrialLog in
Avatar of winart
winart

asked on

Problem with regular expression

hi,

i have problem with regular expression in php..
suppose i want to create a search facility..
when user entered, for example : "artist+korean+pop",
it will begin a search using these 3 words as a keywords.

My problem is.. i don't know how to form a regular expression that match these criterias...
For that example, i will form "(artist|korean|pop)+(artist|korean|pop)+(artist|korean|pop)+".

Very silly heh? if there're 10keywords, it will grow too...
could somebody help me,plz...
Avatar of venkateshwarr
venkateshwarr


Why dont you match inidividual strings in a loop

$strs = split(" ", "artist korean php");

for($i=0;$i<sizeof($strs);$i++)
{
       //match pattern with $strs[$i];
}

venkat.
Avatar of winart

ASKER

that's not what i want..

the pattern "artist+korean+pop" means :
1. these string : "artist korean pop" is match.
2. string : "korean artist pop" is match too!
3. string : "pop artist korean" is match too!

i bet your solution just worked for the 1st possibilities,right?

thx anyway..
ASKER CERTIFIED SOLUTION
Avatar of venkateshwarr
venkateshwarr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of winart

ASKER

that's my problem!

i think it is very silly to create a looping for thing like that..
cause there'll be too many possibilities..
there a simpler approach, right?
by using regular expression...

thx,
Avatar of winart

ASKER

sorry,

i've found the answer..
by using RE.
anyway, thx for helping me..

win