cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
igorsp
Nintex Newbie

Regular expression - capitalize first letter and remove spaces.

Jump to solution

In my workflow I am trying to use the Update Item for all uploaded documents to modify the Name and Title. In case of the Name I would like to do the following:

  • remove spaces
  • capitalize first letter of every word (CamelCase)
  • remove dots, hyphens or underscores (helpful but not required if too complicated)

Anyone had an idea what kind of regular expression can do the above? Thanks!

Labels: (1)
Reply
15 Replies
olampl11
Nintex Newbie

Re: Regular expression - capitalize first letter and remove spaces.

Jump to solution

Hello,

this Blog post should help you.

Here an use full website were you can see if your regex removes all other characters

hobe it helps,

br oli

0 Kudos
Reply
igorsp
Nintex Newbie

Re: Regular expression - capitalize first letter and remove spaces.

Jump to solution

I saw it but it is only a partial solution. Looking for something that can accomplish all my requirements...

0 Kudos
Reply
olampl11
Nintex Newbie

Re: Regular expression - capitalize first letter and remove spaces.

Jump to solution

Ok, basically with the blog you have the main part , capitalizing every single word(just use it in on regular expression action)

The second / third part is a matter of seconds to find via google (Use it in an second action, so it is much easier to fulfill your requirement's)

Br Oli

0 Kudos
Reply
igorsp
Nintex Newbie

Re: Regular expression - capitalize first letter and remove spaces.

Jump to solution

I assume I need to use the Replace operation. What should be in the Replacement text field? Thanks!

2016-04-11_14-11-19.png

Reply
olampl11
Nintex Newbie

Re: Regular expression - capitalize first letter and remove spaces.

Jump to solution

Now I got you (sry ), it is not that simple to capitalize the first letter of each word.

Just with workflow configuration (none code solution), I only see the way described below:

1. Replace the characters which are unwanted with an defined on e.g. Underline _

2. Split the title/name of the document by the underline

3. Remove all empty values form the collection

4. iterate through the rest of the words within the collection, get the first character

5. Replace the character with it's uppercase representation

6. Replace the first character of the current word in the collection with the uppercase character

7. after that, concat your new document name/title

But for me it sounds easier to write a CSOM (JavaScript) to do this conversation in JavaScript.

Or writing an CustomAction (Needs Visualstudio an an full trust solution, only possible for Nintex OnPremise, which can't be brought to SharePoint online.)

Hope I could help, br oli

0 Kudos
Reply
janeyres
Nintex Newbie

Re: Regular expression - capitalize first letter and remove spaces.

Jump to solution

Hi,

If you use the built-in inline functions you'll find this a lot easier.

1. To capitalise each word use the fn-ToTitleCase inline function.

2. To replace spaces or characters use the fn-Replace inline function

Hope that helps.

Jan

Reply
akrasheninnikov
Nintex Newbie

Re: Regular expression - capitalize first letter and remove spaces.

Jump to solution

Replacement text is the text you replace matched with.

0 Kudos
Reply
akrasheninnikov
Nintex Newbie

Re: Regular expression - capitalize first letter and remove spaces.

Jump to solution

Be careful with the quotes in fn-Replace, looks like you don't need any: fn-Replace({WorkflowVariable:variable name},-,)

0 Kudos
Reply
janeyres
Nintex Newbie

Re: Regular expression - capitalize first letter and remove spaces.

Jump to solution

I have tried the code and it works, pretty sure you do need quotes.

0 Kudos
Reply