Expand my Community achievements bar.

SOLVED

Classification Rule Builder and Pipes as a delimiter

Avatar

Level 1

Hello,

I am working on a regular expression within Classification Rule Builder which would look for the value directly after the a colon (:) but would need to stop when it hits a pipe (|). I am running into difficulties getting Rule Builder to see the pipe in the string as the break point.

example: 

s1:bird|s2:monkey|rsc:animal > dog > puppy|s3:cat|

It seems that sometimes [\\|] works but not all of the time. ex. (s2)\:(.+)[\\|](.+|$)

Thanks! smiley

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi Jessica, 

I just saw this question. Not sure, if you are still interested in the answer.

 

You can create the regex in the following manner

s2:([^|]*)

So the "s2:" identifies the marker after which the value needs to be captured. 

The "[^|]" is a condition to look for any character except the pipe symbol.So it breaks if it finds one. and returns all the characters before it.

 

View solution in original post

1 Reply

Avatar

Correct answer by
Employee Advisor

Hi Jessica, 

I just saw this question. Not sure, if you are still interested in the answer.

 

You can create the regex in the following manner

s2:([^|]*)

So the "s2:" identifies the marker after which the value needs to be captured. 

The "[^|]" is a condition to look for any character except the pipe symbol.So it breaks if it finds one. and returns all the characters before it.