Question

Replace string value NOT matching regex, else <null>


Badge +4

Hello,

In one field, I want to keep all string values matching the regex:

\\d{4}-\\d{2}-\\d{2}

and relegate all strings NOT matching that string to:

<null>

 

See following image for my attempt where I developed ^(?!\\d{4}-\\d{2}-\\d{2}).* as the negation of \\d{4}-\\d{2}-\\d{2} and set replacement to <null>. This did not work.

foot_surv_fmeAny pointers would be greatly appreciated!

Tyler


2 replies

Userlevel 1
Badge +10

You could do something like this, test if you get a match on the regexpression (this returns 0) then set the value to null if no match is found

 

image

Badge +4

You could do something like this, test if you get a match on the regexpression (this returns 0) then set the value to null if no match is found

 

image

Thanks @ebygomm​ , that got me on the right track. I ended up using your concept, modified a bit, and in an attribute manager so I could take care of other attributes simultaneously. Here's the result.

imageTyler

Reply