Hi! I have a string that contains this format:
<b>....</b>
......
<b>....</b>
......
etc…
I’m looking to add a string eg:
<div id="x"></div>
just before every nth occurence of
<b>
How can I best achieve this?
Hi! I have a string that contains this format:
<b>....</b>
......
<b>....</b>
......
etc…
I’m looking to add a string eg:
<div id="x"></div>
just before every nth occurence of
<b>
How can I best achieve this?
With text-editor try replacing <b> with <div id=“x”></div><b>
I have just tried replacing the strig using Sublime text ediror and it works fine.
Thanks but this is taking an HTML form input processing and then outputing to screen! I have created the string to be manipulated and need to add in every nth <b> the insert-string
If you are using PHP then try this:
$str = "this is a test to see if it works<b>...BOLD...</b>";
$str .= $str;
$x = '<div id="x"></div><b>';
$new = str_replace('<b>', $x, $str);
echo '<br />';
echo $new;
echo '<br />';
echo '<br />';
echo highlight_string($new);
echo '<br />';
echo '<br />';
this is a test to see if it works
…BOLD…this is a test to see if it works
…BOLD…
this is a test to see if it works<div id=“x”></div><b>…BOLD…</b>this is a test to see if it works<div id=“x”></div><b>…BOLD…</b>