Skip to main content
Solved

Regex replace

  • July 12, 2023
  • 4 replies
  • 36 views

Forum|alt.badge.img+9

Hi, i have a formula field named "Jenis Parts Regex" where its value is "15.9mm Karet stabil FR RH/LH ES1|05".

I want to extract anything that matches "end_of_name" field, in this case "ES1|05", and the result shall be in "regex replace" field.

But what i got there is "15.9mm Karet stabil FR RH/LH |". Why am i getting "|" ?

Here is my formula in "regex replace" field:

REGEX_REPLACE({Jenis Parts Regex},end_of_name,"")

Please help
Thanks

 

Best answer by Sho

Hi @kennypurnomo ,

In regex, "|" means OR.
So "ES" or "05" is replaced and "|" remains.
If "|" in end_of_name is escaped to "\|", it is treated as a string and can be replaced.

4 replies

Forum|alt.badge.img+21
  • Inspiring
  • Answer
  • July 12, 2023

Hi @kennypurnomo ,

In regex, "|" means OR.
So "ES" or "05" is replaced and "|" remains.
If "|" in end_of_name is escaped to "\|", it is treated as a string and can be replaced.


Forum|alt.badge.img+9
  • Author
  • Known Participant
  • July 12, 2023

thanks!


Forum|alt.badge.img+9
  • Author
  • Known Participant
  • July 12, 2023

How do i proceed with this? i tried to 


REGEX_REPLACE(end_of_name,"|","\|")

But the result is this
\|D\|D\|1\||\|1\|4\|

Forum|alt.badge.img+21
  • Inspiring
  • July 12, 2023
In your example, it would be like this.

 

REGEX_REPLACE("15.9mm Karet stabil FR RH/LH ES1|05","ES1\|05","")