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

How to replace a string contains \ in another string using regular expression

Jump to solution

Hi everyone,

I have a to be replaced text in this format: "dd\name". I want to replace this text in a multiline field using regular expression. 

Tried different things like "dd\\name" or "dd/\name" or "dd*\\\\\" in pattern and still couldn't figure that out.

Does anybody have an idea?

Thanks!

Labels: (2)
Tags (1)
0 Kudos
Reply
5 Replies
Automation Master
Automation Master

Re: How to replace a string contains \ in another string using regular expression

Jump to solution

what about this pattern?

\w+\\\w+

Reply
sarasafari
Nintex Newbie

Re: How to replace a string contains \ in another string using regular expression

Jump to solution

Thanks Martin,

The pattern works perfectly for replacing \ but how can I tell to replace before and after words if they're matched?

here is the example if signer = na\ssafari => Replace na\ssafari with "Replaced".

if signer = aa\mhatala => Replace  aa\mhatala with "Replaced".

Thanks

0 Kudos
Reply
Automation Master
Automation Master

Re: How to replace a string contains \ in another string using regular expression

Jump to solution

I'm not sure I understand what you mean.

the pattern I suggested replaces any two consecutive words split by single backslash. do you mean to replace only exact string pattern? so eg if there appear na\ssafari in the text then replace it, but if there appears eg. an\ssafari then do not replace it?

if so, then your pattern simply should look like

na\\ssafari

0 Kudos
Reply
sarasafari
Nintex Newbie

Re: How to replace a string contains \ in another string using regular expression

Jump to solution

I figured that out,

na\\ssafari will replace na\ssafari in a string.

View solution in original post

0 Kudos
Reply
Automation Master
Automation Master

Re: How to replace a string contains \ in another string using regular expression

Jump to solution

great!

if you've got a solution please mark question answered.

Reply