Jump to content

Recommended Posts

I wonder if is out there function in php that is doin this .

function like strpos that is does not notice from CAPITAL words to small words.

function like strpos that does finds all matchs and not only 1.

function like strpos that is search inside connected words like "strposfunction" so if i search "function" it will find it.

thanks , Mor.

Link to comment
https://forums.phpfreaks.com/topic/211513-built-in-functions/
Share on other sites

Yes there are. They use regular expressions as parameters. Regular expressions are difficult at first, but they are essential when you are working with text strings.

 

http://uk.php.net/manual/en/function.preg-match.php

http://uk.php.net/manual/en/function.preg-match-all.php

 

Here is a good starting point.

http://www.webcheatsheet.com/php/regular_expressions.php

Link to comment
https://forums.phpfreaks.com/topic/211513-built-in-functions/#findComment-1102747
Share on other sites

i was always refuse to learn regex but i think this is time to learn.

thanks , Mor.

 

Regex is good to know and I would say to learn it, however, if you could be more specific about your last two questions, it may be simpler.

 

For the second question, 'find the number of matches' or the 'starting postion of all matches'?

 

For the last question, that's exactly what strpos() does.  What do you mean by find it?  strpos("strposfunction", "function"); returns 6, so it found it.

Link to comment
https://forums.phpfreaks.com/topic/211513-built-in-functions/#findComment-1102785
Share on other sites

I meant that strpos function find 1 match and than give back the result.

I looking for function that actually find all matches in the text and not the first one.

about the last function i was talking about i was confused so forget about it.

and thanks for interesting , Mor.

Link to comment
https://forums.phpfreaks.com/topic/211513-built-in-functions/#findComment-1102905
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.