Regex help - convert ALL CAPS to Caps if WORD is only WORD on line

2012-02-21 Thread TJ Luoma

Hi, my name is TJ and I'm terrible at regular expressions :-)

Here's what I want to do:

Match: Any line which is one word long (where 'word' is defined as
ASCII letters, only) and that word is ALL CAPS

Do:
* Change word from UPPERCASE to Capitalized
* Put a colon after WORD
* Wrap that word (and colon) in ** **
* Change EOL to a space.

So, for example

FOO
bah ablah alasfas

would become

**Foo:** bah ablah alasfas

Possible?

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: Regex help - convert ALL CAPS to Caps if WORD is only WORD on line

2012-02-21 Thread Olof Svensson
English is not my first language. I try to keep it short, but I don't want to 
sound unfriendly.

Try
^([A-Z])([A-Z]+)$\r
replace
**\1\L\2:** 
--
Olof Svensson
--
A scientist will never show any kindness for a theory which he did not start 
himself.

-M.Twain



-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit


Re: Regex help - convert ALL CAPS to Caps if WORD is only WORD on line

2012-02-21 Thread Christian Boyce
I am sure that this is possible. 

I am also sure that there are a lot of people who can give you the magic 
formula, as easily as if you'd asked me for help spelling cat. However, if 
you don't get an answer from someone else, let me know. I speak a little GREP 
and think I could bang this out for you.

c
On Feb 21, 2012, at 11:11 AM, TJ Luoma wrote:

 
 Hi, my name is TJ and I'm terrible at regular expressions :-)
 
 Here's what I want to do:
 
 Match: Any line which is one word long (where 'word' is defined as
 ASCII letters, only) and that word is ALL CAPS
 
 Do:
 * Change word from UPPERCASE to Capitalized
 * Put a colon after WORD
 * Wrap that word (and colon) in ** **
 * Change EOL to a space.
 
 So, for example
 
 FOO
 bah ablah alasfas
 
 would become
 
 **Foo:** bah ablah alasfas
 
 Possible?
 
 -- 
 You received this message because you are subscribed to the 
 BBEdit Talk discussion group on Google Groups.
 To post to this group, send email to bbedit@googlegroups.com
 To unsubscribe from this group, send email to
 bbedit+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/bbedit?hl=en
 If you have a feature request or would like to report a problem, 
 please email supp...@barebones.com rather than posting to the group.
 Follow @bbedit on Twitter: http://www.twitter.com/bbedit


--
Christian Boyce
Christian Boyce and Associates
Mac, iPhone, and iPad Consultants
New Main Phone Number: 424-354-3548

Read the Boyce Blog: http://christianboyce.blogspot.com
Follow us on Twitter! http://twitter.com/christianboyce
Be a fan on Facebook! http://tinyurl.com/cboyce-and-associates-facebook

Now Playing on The Boyce Blog: Built-in Siri Tip Sheet

-- 
You received this message because you are subscribed to the 
BBEdit Talk discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem, 
please email supp...@barebones.com rather than posting to the group.
Follow @bbedit on Twitter: http://www.twitter.com/bbedit