Question

Hi Could someone confirm the STRING REPLACEMENT behaviour with REGEX please ?

  • 3 March 2022
  • 3 replies
  • 36 views

It is possible to find a REGEX within a string (works perfectly) but I think that it doesn't work with the replacement option.

Just to give an example, I try to replace the first letter of words with its uppercase. 

john wayne should become John Wayne

 

The find Regex is ([a-z])([a-z]{0,}) to split the first letters from the others in 2 blocks

According to regex101 website, the substitution should be \U$1\L$2 (\U$$1\L$$2 for AA because of the $ specificity)

The result is not what expected >> UjLohn UwLayne U and L caracters are displayed instead of the first block uppercase transformation

 

Any idea ?

I can make it diffently of course but this is probably the best way i can think about

 

Thx in advance

Stéphane


3 replies

Hi @Stéphane Sévos​ ,

 

Split Input String based on space Delimeter and use list loop to iterate all items try to extract substring and regex as below

 

imageimageimageRegards,

Bhargavi

Thx for your help

 

I did smthg quite similar based on split and extract

 

I notice you use a regex tool. Is this an extra package from the bot store ?

 

According to you, is the original string replace action not fully compatible with regex options (find or substitutions) ?

 

best rgds

S.

Hi @Stéphane Sévos​ 

 

* Please download Regex tools package from BOT store.

*I think with single string replace (regex )won't work for your requirement

 

Regards,

Bhargavi

Reply