Inserting custom tags into a string
Posted: Fri Nov 13, 2009 7:18 am
I have a simple PHP script which parses through HTML files, it removes certain tags and special characters, and replaces with with others using. I can alter about 95% of each file to the format i want without a problem, however i've run into an issue when i want to wrap certain strings in tags, for example when it comes up against something like this
I need to wrap each -'d bullet point in a tag, like this;
will become
i can start it off easily enough, by using
i was wondering if there is something simliar that'll replace the '-', ignore the following text and the write the end tag after the following '.'
any ideas would be appreicated
Code: Select all
....
– Example 1: asasdergergegerg asfdsf.
– Example 2: asdfs fergseg erggdfgsr.
– Example 3: werwe rsegsergsegafsd fasdf2.
– Example 4: gdfgjkhgsergser gajkgahwklf.
– Example 5: gdfggse gserkhajkgahwklf.
– Example 6: gdfgjrgaergerhajkga hwklf.
– Example 7: gdgaw ergwerggjkhajkg ahwklf.
– Example 8: gdf gjkhajk dfgerg ega eggahwklf.
....
I need to wrap each -'d bullet point in a tag, like this;
Code: Select all
– Example 1: asasdergergegerg asfdsf.Code: Select all
<SpecialTag, startBullet> Example 1: asasdergergegerg asfdsf. <SpecialTag, endBullet>i can start it off easily enough, by using
Code: Select all
str_replace("–", "<SpecialTag, startBullet>", $fileData);
any ideas would be appreicated