Solved

How to replace a "pipe" in a regular expression ?

  • 2 February 2016
  • 6 replies
  • 405 views

Badge +6

Hello,

 

As you can see in the screen, I used a regular expression to replace an expression like : i:0#.w|blablabla to blablabla

But when I execute my action the expression is : |blablabla

 

Problem :

When I used regular expression, this part "i:0#.w" is delete so it's OK but I don't know why the pipe "|" stay.

I try ASCII into the regular expression but it not work &#124

 

 

Do you have solution to fix it ?

icon

Best answer by francois 2 February 2016, 19:56

View original

6 replies

Badge +11

Hi Theo,

A pipe "|" expression in regex tells the system that a match can be on either side of the |. To replace this character you may have to escape it.

I'm not a pro at regex but this is what i have seen in the past. See more details here: replacing pipe "|"

Badge +6

Absolutely

Add backslash before the pipe to have the correct result.

remove_pipe.png

Badge +6

Thanks, I'm going to try and get back to you =)

Badge +6

Thanks for your help ! It works well =)

KR

Theo

Badge +6

Yes, sorry I forgot

Badge +4

Thank you very much.  I am now trying to do the same with a form variable in New Responsive and I cannot get this to work.  When I use 



  • Start is: i:0#.x|member|i999999@test.com

  • Variable setup is:  replace(FORM.FieldName),"i:0#.x|member|","")

  • Result is:  ||i999999@test.com


 


Do you @francois  know how to remove the pipe in this case? When I try to use a backslash it disallows this in the variable setup.


 

Reply