Icon

kn_​example_​text_​number_​value_​regex

Use Java and Regex to extract the last portion of a ID number

Find a pattern in a string with a combination of Java or R

Use Java and Regex to extract the last portion of a ID numberhttps://www.careercup.com/question?id=15006717https://forum.knime.com/t/finding-smallest-common-product-id/13554/5?u=mlauber71 Pattern p = Pattern.compile("\\-(?:.(?!\\-))+$");Matcher m = p.matcher($id$);if(m.find()) { return m.group(0);}else {return "";} library(stringr)v_pattern <- "\\-(?:.(?!\\-))+$"knime.out <- knime.inknime.out$id2 <- str_extract(knime.out$id, v_pattern) Node 1find pattern in Javasame in RremoveChars($last_id_part$, "-") Table Creator Java Snippet(simple) R Snippet String Manipulation Use Java and Regex to extract the last portion of a ID numberhttps://www.careercup.com/question?id=15006717https://forum.knime.com/t/finding-smallest-common-product-id/13554/5?u=mlauber71 Pattern p = Pattern.compile("\\-(?:.(?!\\-))+$");Matcher m = p.matcher($id$);if(m.find()) { return m.group(0);}else {return "";} library(stringr)v_pattern <- "\\-(?:.(?!\\-))+$"knime.out <- knime.inknime.out$id2 <- str_extract(knime.out$id, v_pattern) Node 1find pattern in Javasame in RremoveChars($last_id_part$, "-") Table Creator Java Snippet(simple) R Snippet String Manipulation

Nodes

Extensions

Links