WordPress.org

Forums

PHP question (3 posts)

  1. Anonymous
    Unregistered
    Posted 10 years ago #

    I have a string that includes a tag (that needs to be replaced), however the tag is not fixed, though it has a fixed mask: tag-name(%parameter).
    Ok.. now the hard part. Is there a PHP function that will return such substrings, i.e. all substrings that match a certain mask?
    What I want to accomplish is to replace the tag with some text, based on the specified parameter.
    Thank you kindly for any suggestions,
    icxn

  2. Zarniwoop
    Member
    Posted 10 years ago #

    What about preg_replace_callback?

  3. Anonymous
    Unregistered
    Posted 10 years ago #

    Thank you very much.. :)
    Now the problem is to figure out the right pattern (regular expression), to allow for:
    <mytag>,
    <mytag=keyword>, (ex. <mytag=5> or <mytag='some text'>)
    <mytag=keyword1, keyword2...> (ex. <mytag=5, 'some text'>)
    I ask a lot... I know :)
    icxn

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.