For indenting a string of text coming from a textarea I'm using the following regex:
$string =~ s/\x20/ \;/g;
The problem with this is that is between every word when the string is inserted into the db/displayed on a web page. In effect it is working as planned but I see it causing extra loading time for the web page and putting a ton of 's in the db.
Is there any way the regex can be modified to just "do it's thing" at the beginning of a string and not everywhere it finds an empty space?
I tried $string =~ s/^\x20/ \;/g; but when I did that I could only indent by one space and only one the first paragraph. While I did manage to figure out how to separate the paragraphs by using a regex to insert a <br /> tag I haven't been able to come up with anything on this one yet.
I could live without the indentations but it has become a personal thing and some people just like to have their paragraphs started with an indent.