PHP: Return string between two characters

Posted by Nic Hubbard on Stack Overflow See other posts from Stack Overflow or by Nic Hubbard
Published on 2010-01-12T07:15:30Z Indexed on 2010/04/11 6:43 UTC
Read the original article Hit count: 158

Filed under:
|
|
|
|

I am wanting to use "keywords" within a large string. These keywords start and end using *my_keyword* and are user defined. How, within a large string, can I search and find what is between the two * characters and return each instance?

The reason it might change it, that parts of the keywords can be user defined, such as *page_date_Y* which might show the year in which the page was created.

So, again, I just need to do a search and return what is between those * characters. Is this possible, or is there a better way of doing this if I don't know the "keyword" length or what i might be?

© Stack Overflow or respective owner

Related posts about php

Related posts about keywords