Find & Replace Capital Letter

P

prkhan56

Hello All,
I am using Office 2003.
I have a document where text is as follows eg:

AbcdEfghIjklMnopQrstUvwxYz

I wish to have space inserted before each 'Captial' letter where the
final result should be as follows:

Abcd Efgh Ijkl Mnop Qrst Uvwx Yz

Any help would be appreciated.

TIA
Rashid Khan
 
L

lynn.taylor

Hi Rashid - you can use an expression in the Find and Replace box. Try
the following
Click on Edit, Replace, in the Find What box type ([A-Z])([a-z]{3}), in
the replace with box type \1\2space (don't type the word space, just
insert a space using the space bar.

Ensure there is a tick in the Wildcards tick box.

The Expression explained:
The first pattern
([A-Z]) this is the first pattern which is contained inside
paranthesis. It says, find any capital letter between A and Z.

The second pattern
([a-z]{3}) this is the second pattern which is contained inside a
separate set of paranthesis. It says, find any lower case character
between a-z which is 3 characters long.

The whole expression put together says "find an upper case letter
followed by 3 lower case letters.

The replace with box says replace with pattern 1 then replace with
pattern two then add a space. So pattern 1 is represented by "\1" and
patter 2 is represented by "\2", basically the it is replacing what it
found then adds on a space. So it finds Abcd, replaces it with Abcd
and adds a space.

Regards
Lynn
 
P

prkhan56

Hi Lynn,
Sorry, the expression I used is just for example purpose... My real
problem may or may not have 3 characters after the capital.
Can you suggest something which would look for Captial letter and
insert space before the capital (irrespective of the lenght of the
word)

Thanks in advance
Rashid
Hi Rashid - you can use an expression in the Find and Replace box. Try
the following
Click on Edit, Replace, in the Find What box type ([A-Z])([a-z]{3}), in
the replace with box type \1\2space (don't type the word space, just
insert a space using the space bar.

Ensure there is a tick in the Wildcards tick box.

The Expression explained:
The first pattern
([A-Z]) this is the first pattern which is contained inside
paranthesis. It says, find any capital letter between A and Z.

The second pattern
([a-z]{3}) this is the second pattern which is contained inside a
separate set of paranthesis. It says, find any lower case character
between a-z which is 3 characters long.

The whole expression put together says "find an upper case letter
followed by 3 lower case letters.

The replace with box says replace with pattern 1 then replace with
pattern two then add a space. So pattern 1 is represented by "\1" and
patter 2 is represented by "\2", basically the it is replacing what it
found then adds on a space. So it finds Abcd, replaces it with Abcd
and adds a space.

Regards
Lynn

Hello All,
I am using Office 2003.
I have a document where text is as follows eg:

AbcdEfghIjklMnopQrstUvwxYz

I wish to have space inserted before each 'Captial' letter where the
final result should be as follows:

Abcd Efgh Ijkl Mnop Qrst Uvwx Yz

Any help would be appreciated.

TIA
Rashid Khan
 
L

lynn.taylor

Hi again - yes I can - instead of putting 3 in the curly brackets put a
1 and a comma, so your expression should look like this
([A-Z])([a-z]{1,})

The expression says "look for at least "1" occurences of the previous
character or expression"
Regards
Lynn

Hi Lynn,
Sorry, the expression I used is just for example purpose... My real
problem may or may not have 3 characters after the capital.
Can you suggest something which would look for Captial letter and
insert space before the capital (irrespective of the lenght of the
word)

Thanks in advance
Rashid
Hi Rashid - you can use an expression in the Find and Replace box. Try
the following
Click on Edit, Replace, in the Find What box type ([A-Z])([a-z]{3}), in
the replace with box type \1\2space (don't type the word space, just
insert a space using the space bar.

Ensure there is a tick in the Wildcards tick box.

The Expression explained:
The first pattern
([A-Z]) this is the first pattern which is contained inside
paranthesis. It says, find any capital letter between A and Z.

The second pattern
([a-z]{3}) this is the second pattern which is contained inside a
separate set of paranthesis. It says, find any lower case character
between a-z which is 3 characters long.

The whole expression put together says "find an upper case letter
followed by 3 lower case letters.

The replace with box says replace with pattern 1 then replace with
pattern two then add a space. So pattern 1 is represented by "\1" and
patter 2 is represented by "\2", basically the it is replacing what it
found then adds on a space. So it finds Abcd, replaces it with Abcd
and adds a space.

Regards
Lynn

Hello All,
I am using Office 2003.
I have a document where text is as follows eg:

AbcdEfghIjklMnopQrstUvwxYz

I wish to have space inserted before each 'Captial' letter where the
final result should be as follows:

Abcd Efgh Ijkl Mnop Qrst Uvwx Yz

Any help would be appreciated.

TIA
Rashid Khan
 
P

prkhan56

Hi Lynn,
Works great. Thanks for your time and help

Regards
Rashid
Hi again - yes I can - instead of putting 3 in the curly brackets put a
1 and a comma, so your expression should look like this
([A-Z])([a-z]{1,})

The expression says "look for at least "1" occurences of the previous
character or expression"
Regards
Lynn

Hi Lynn,
Sorry, the expression I used is just for example purpose... My real
problem may or may not have 3 characters after the capital.
Can you suggest something which would look for Captial letter and
insert space before the capital (irrespective of the lenght of the
word)

Thanks in advance
Rashid
Hi Rashid - you can use an expression in the Find and Replace box. Try
the following
Click on Edit, Replace, in the Find What box type ([A-Z])([a-z]{3}), in
the replace with box type \1\2space (don't type the word space, just
insert a space using the space bar.

Ensure there is a tick in the Wildcards tick box.

The Expression explained:
The first pattern
([A-Z]) this is the first pattern which is contained inside
paranthesis. It says, find any capital letter between A and Z.

The second pattern
([a-z]{3}) this is the second pattern which is contained inside a
separate set of paranthesis. It says, find any lower case character
between a-z which is 3 characters long.

The whole expression put together says "find an upper case letter
followed by 3 lower case letters.

The replace with box says replace with pattern 1 then replace with
pattern two then add a space. So pattern 1 is represented by "\1" and
patter 2 is represented by "\2", basically the it is replacing what it
found then adds on a space. So it finds Abcd, replaces it with Abcd
and adds a space.

Regards
Lynn

(e-mail address removed) wrote:

Hello All,
I am using Office 2003.
I have a document where text is as follows eg:

AbcdEfghIjklMnopQrstUvwxYz

I wish to have space inserted before each 'Captial' letter where the
final result should be as follows:

Abcd Efgh Ijkl Mnop Qrst Uvwx Yz

Any help would be appreciated.

TIA
Rashid Khan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top