# Processing an INVERTED COMMA/QUOTATION MARK in a Rule-based filter

**URL:** <https://forum.knime.com/t/processing-an-inverted-comma-quotation-mark-in-a-rule-based-filter/66148>\
**Category:** KNIME Analytics Platform\
**Created:** [April 27, 2023, 2:59am UTC](https://forum.knime.com/t/processing-an-inverted-comma-quotation-mark-in-a-rule-based-filter/66148 "2023-04-27T02:59:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AAM](https://forum-cdn.knime.com/user_avatar/forum.knime.com/aam/32/44417_2.png) [@AAM](https://forum.knime.com/u/AAM)\
**Post date:** [April 27, 2023, 2:59am UTC](https://forum.knime.com/t/processing-an-inverted-comma-quotation-mark-in-a-rule-based-filter/66148/1 "2023-04-27T02:59:44Z")

</div>

In my dataset there is a column called “`SmokesPerDay`”. I am looking to extract a number from this column, as there are many entries with additional text qualifications.

I am asking two questions:

1. **How do I identify an entry which starts with " like this one?**

> “changes on the day”

I tried using the following expression - `$08b.SmokesPerDay$ MATCHES "["]{1,}.*"` - but it greys out on error checking. Also tried an escape character - `$08b.SmokesPerDay$ LIKE "\"*"` - but also no good.

1. As you can already tell, I am unskilled in Regex (as with many coding issues), but **how do I select the entries where the first 2 characters are numbers**? (and yes, I realise that if I can do this, my first question is irrelevant, but I’ll include it anyway.)

As always, help appreciated and humbling!

A

---

<div class="post-metadata">

**Author:** ![bruno29a](https://forum-cdn.knime.com/user_avatar/forum.knime.com/bruno29a/32/28802_2.png) [@bruno29a](https://forum.knime.com/u/bruno29a)\
**Post date:** [April 27, 2023, 5:40am UTC](https://forum.knime.com/t/processing-an-inverted-comma-quotation-mark-in-a-rule-based-filter/66148/2 "2023-04-27T05:40:33Z")

</div>

Hi @AAM ,

It could be that what you copied/pasted here is not exactly how they are in reality, but if that was the case, then what you pasted does not satisfy your condition simply because the quotes that you are evaluating are different.

Here’s a sample data I worked with:  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/d/3/d364d928d21c700c308ba9fe01be336f6b369a9c.png)

And the first row, with ID = 1 is what I copied from you.

If I do the check via String Manipulation using this expression, I am able to get the expected results:

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/2/9/295963eaff1b9afc7c7e9b80a3a1da6d4f950cfe.png)  
`substr($column1$, 0, 1).equals("\"") ? "True" : "False"`

(This expression is checking if the first character is a quote `"`, in which case it will return “True”, otherwise will return “False”)

![image](https://forum-cdn.knime.com/uploads/default/original/3X/e/d/ed11b6cc7a7a7e83c7ebda042c62eb2146628561.png)  
As expected, only the row with ID = 2 will match as it contains the quotes that we are looking for (Row ID = 1 has different quotes, that’s what I copied and pasted from your post)

Similarly, if I do a Row Filter, it works too:

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/0/4/04785677017d9b14713e0497a89470e7573a8295.png)  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/f/0/f0f1064429b04e7fa227ade8cefb1ae7c6ecd8a2.png)

With the Rule-based Row Filter, somehow, Knime does not seem to like the statement `LIKE "\"*"`. It’s ok to do `LIKE "\t*"` for example, but it gives an error if we do `LIKE "\"*"`. It looks like we’d have to use regex via the MATCHES statement as a workaround.

Any reason why you need to use the Rule-based Row Filter instead of the Row Filter node?

As for your 2nd question, you can do this via the Rule-based Row Filter indeed with this expression:  
`$column1$ MATCHES "[0-9][0-9].*" => TRUE`

---

<div class="post-metadata">

**Author:** ![AAM](https://forum-cdn.knime.com/user_avatar/forum.knime.com/aam/32/44417_2.png) [@AAM](https://forum.knime.com/u/AAM)\
**Post date:** [April 28, 2023, 5:45am UTC](https://forum.knime.com/t/processing-an-inverted-comma-quotation-mark-in-a-rule-based-filter/66148/3 "2023-04-28T05:45:34Z")

</div>

_Any reason why you need to use the Rule-based Row Filter instead of the Row Filter node?_

Not particularly except that I was trying to filter a whole lot of rubbish out, and because I suck at Regex your nice final solution was beyond me.

Thanks for taking the time. I am very grateful and appreciative,

A

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [July 27, 2023, 5:46am UTC](https://forum.knime.com/t/processing-an-inverted-comma-quotation-mark-in-a-rule-based-filter/66148/4 "2023-07-27T05:46:32Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
