Congratulations to all monthly winners of May 2013 !!! They have won INR 2900 cash and INR 27497 worth prize.
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 1954 |  Welcome, Guest!   Register  Login
 Home > Forums > Regular Expression > put space before each capital located between <title></title> t ...
Sebastiz

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

Replies: 2 | Posted by: Sebastiz on 5/6/2012 | Category: Regular Expression Forums | Views: 408 | Status: [Member] | Points: 10  


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?


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Siva524
Siva524  
Posted on: 5/7/2012 6:28:54 AM
Level: Starter | Status: [Member] | Points: 25

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. | Reply | Alert Moderator 

Sebastiz
Sebastiz  
Posted on: 5/7/2012 8:04:45 AM
Level: Starter | Status: [Member] | Points: 25

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. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 6/18/2013 4:55:53 PM