• Resolved OM2

    (@om2)


    I want to write a plugin that replaces occurrences of special code like [myCont=qwerty]

    So, I want the plugin to look for ‘[myCont=’ and look for the matching end ‘]’ and then do something with the bits in the middle

    I’ve looked up other functions and am unsure the best approach

    I’ve seen preg_match_all used as well as substr

    I wanted to know which method was better?
    Are there any other functions that do text replacement that I might want to consider in PHP?

    Thanks

    Omar

Viewing 2 replies - 1 through 2 (of 2 total)
  • Since that’s exactly what the Shortcode_API is all about, might look into how WordPress cores does that.

    Thread Starter OM2

    (@om2)

    WOW!
    that’s awesome ??
    damn – and i’ve actually spent a lot of time researching how to manually do what shortcodes does

    it’s really confusing though. i’m going to read again a few times and follow some of the examples given.

    thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘preg_match_all or substr?’ is closed to new replies.