Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Lookup matching regular expression in Calc

I want to implement classification based on regular expressions.
In sheet1 I have
Item    Class   Wanted Class
apples1 =???    apples
apples2         apples
apples3         apples
Pear A          pears
Pear B          pears
Melon           other

In sheet2 I have:
Regex       Class
.*apples.*  apples
.*Pear.*    pears
.*          other

What formula to put in sheet1.B so they have the same values like C?
Does Calc have a function that can be used in formula that makes regular expression replace?
click to hide/show revision 2
cleanup formatting

Lookup matching regular expression in Calc

I want to implement classification based on regular expressions. In sheet1 I have have

A       B       C
Item    Class   Wanted Class
apples1 =???    apples
apples2         apples
apples3         apples
Pear A          pears
Pear B          pears
Melon           other
 

In sheet2 I have: have:

A           B
Regex       Class
.*apples.*  apples
.*Pear.*    pears
.*          other
 

What formula to put in sheet1.B so they have the same values like C? Does Calc have a function that can be used in formula that makes regular expression replace?