You are viewing limited content. For full access, please sign in.

Question

Question

Is There a Regular Expression to Pull all the Capital Letters out of a Phrase?

asked on August 18, 2015

I am asking to see if anyone has a regular expression that would pull just the capital letters out of an expression?  For example if I have the committee name Technical Advisory Committee, I want an express that will pull just TAC.  I have tried [ABCDEFGHIJKLMNOPQRSTUVWXYZ] and \p(Lu) but each only pulls the 1st capital letter.  I have tired to use * and + and {n,} to get all but I can't make it pull all the capital letters.

 

Thanks for any help!

0 0

Answer

SELECTED ANSWER
replied on August 18, 2015

In-line regular expression does not support all the options you would get if you used the Pattern Matching activity. You can use Ken's workaround below or switch to using a Pattern Matching activity. I find the activity a bit more straightforward to use in this case because it has the exact options you want: case sensitiveness and combining results.

2 0

Replies

replied on August 18, 2015

you only need to use [ABCDEFGHIJKLMNOPQRSTUVWXYZ]

2 0
replied on August 18, 2015

 

I did this, and then you can use the outputted token as the value of a token, then display that token with the "Apply Index" and "all Items separated by a space, then on the token in the field after you exit the editor, remove the space in the middle of the '[ ]' 

1 0
replied on August 18, 2015

What product are we talking about? If it's either Workflow or Quick Fields, you want to set pattern matching to return "all matches" instead of "first match".

0 0
replied on August 18, 2015

In workflow I am trying to pull just the capital letters in the token dialog box when I use the field to name something.  I want the field itself to have the committee name spelled out.  When I use it to name a document I want just the capital letters to show.

 

0 0
replied on August 18, 2015

Jennifer,

You can also use [A-Z] to capture capital letters.  [a-z] captures lower-case.  This may make it easier if you have to reproduce this later on.  

1 0
SELECTED ANSWER
replied on August 18, 2015

In-line regular expression does not support all the options you would get if you used the Pattern Matching activity. You can use Ken's workaround below or switch to using a Pattern Matching activity. I find the activity a bit more straightforward to use in this case because it has the exact options you want: case sensitiveness and combining results.

2 0
replied on August 18, 2015

Pattern Matching worked GREAT!!!

0 0
replied on August 18, 2015

I can't see your full expression, does the same expression work no matter how many words are in the phrase?  Some have 3, some have 5, some have 6.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.