Delete Cells based on Text

27 views
Skip to first unread message

Matthew Gilbert

unread,
Jul 20, 2016, 5:33:05 PM7/20/16
to OpenRefine
Currently column looks like:

mouse1
mouse1
mouse1
xx1
mouse2
mouse2
mouse2
mouse2
xx2
mouse3
mouse3
mouse3
xx3

I want to delete the data (leaving a blank cell) for all the xx1, xx2, xx3 etc

Thanks

John Little

unread,
Jul 20, 2016, 5:39:12 PM7/20/16
to openr...@googlegroups.com
Here's a solution:

  1. Column 1 > Text filter
  2. In the Text filter enter:  xx
  3. Column 1 > Edit cells > Transform...
    1. Expression = ""
  4. Close the Text Filter


--
You received this message because you are subscribed to the Google Groups "OpenRefine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openrefine+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthew Gilbert

unread,
Jul 21, 2016, 12:50:44 PM7/21/16
to OpenRefine
Thanks John...

John Little

unread,
Jul 21, 2016, 2:44:41 PM7/21/16
to openr...@googlegroups.com
You're welcome.

Another way to do it is perform a Find & Replace
    1. Column 1 > Edit cells > Transform...
    1. Expression =   value.replace(/xx\d+/,"") 
      • xx is a literal match 
      • \d matches any digit (number)
      • + is a multiplier (1 or more) - in this case modifying \d means "one or more digits"
      • This works for your sample data.  More data might require a more sophisticated regular expression (the part between the two slashes / /   )
Reply all
Reply to author
Forward
0 new messages