How do I do this?

I use the following code to get position of the first occurrence (case insensitive) of $search within $space.

$word = stripos($space, $search);

However I would like to totally ignore some characters while matching and get the position of similar substrings within the search space. Suppose:

$space = "this is a string saying hello-world";
$search = "hello world";

I would like to have the position of "hello-world" returned even though the string searched was "hello world".

Anyone know how to do this?

Member Avatar

did you check out your last thread on this? You're still waiting... So am I.

I think you're needing Regular Expressions methods look into the PHP Manual you might find what you're looking for!

For example:




This will match all the occurrences in a string that matches whatever is in the $space variable or by the worlds between the parenthesis separated by the column (I don't remember exactly how that symbol is called, sorry!)