I looked it up. Chapter 8, right?
If you read through that chapter, you'll see the author isn't really using regex to "format" the content in the way CSS does. What he does is create a bbcode parser. As explained in the book, bbcode is used in forums to give the users a simple means to add some formatting to the things they write, using bbcode tags.
But since browser don't understand bbcode, these tags have to be replaced by valid html before outputting the content to the user.
It's this replacing that is done using regex.
The way the final html code is formatted will depend as always on your CSS.
Another common use for regex is validation of user input.