put space before each capital located between <title></title> tags

Posted by Sebastiz under Regular Expressions on 5/6/2012 | Points: 10 | Views : 1437 | Status : [Member] | Replies : 2
I have a load of webpages. Each has a title tag. The problem is that the title is a load of words that have all merged together. Eaach word does start with a capital.

eg

<title>TheCatSatOnTheMat</title>

Some of them have acronyms eg <title>IBDTheCatSatOnTheMat</title>

I would like to keep continuous capitals as one word, but if preceeded by a lower case letter (or by <title>) I would like there to be a whitespace.

Can anyone help?




Responses

Posted by: Siva524 on: 5/7/2012 [Member] Starter | Points: 25

Up
0
Down
one solution is
generally title name must have space between the words
so one idea is
<title>

<h1>The&nbsp;Cat&nbsp;Sat&nbsp;On&nbsp;The&nbsp;Mat&nbsp;</h1>
</title>


Sebastiz, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sebastiz on: 5/7/2012 [Member] Starter | Points: 25

Up
0
Down
Thanks Siva524. I guess I was asking how to do this rather than alternatives. Anyway I think I've figured it out with a regular expression although I have to re-run the expression to seperate all the names. It is

Find: (?<=\btitle>)(.*?)([a-z])([A-Z])
Replace: $1$2 $3

Sebastiz, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response