I'm unsure of how to do the following...
I need to search through a string
and match all instances of a forward slash
and certain letters
. This is for word modifications that users have the ability to input and I want them to be able to modify individual words.
Here is an example string
Hello, isn't the weather just absolutely beautiful today!?
What I'd like the user to be able to do is something like this
Hello, isn't the /bo weather just /it beautiful today!?
take note of the /bo
and /it
what I'd like to do is have a preg_match
and or preg_replace
statement that finds and replaces the instances of /bo
and /it
and converts them instead into html tags such as bolded html tag
and italics html tag
(i cant type them here or they get converted into actual html. but wrap themselves around the word immediately following the /bo
so in this example it would wind up being
Hello, isn't the <b>weather</b> just <i>beautiful</i> today!?
Any ideas how I could do this with a regex
?
Once the conversions are done i'll do the standard sanitizing before inserting the data into the database along with prepared statements.